Webpack main concepts.
By default, Webpack 4 doesn't need a configuration file. It will use ./src/index.js
as the entry point and will put the bundle in ./dist/main.js
.
Also, we can specify a mode
to use optimizations out of the box:
development
: Setsprocess.env.NODE_ENV
todevelopment
. EnablesNamedChunksPlugin
andNamedModulesPlugin
.production
: Setsprocess.env.NODE_ENV
toproduction
. EnablesFlagDependencyUsagePlugin
,FlagIncludedChunksPlugin
,ModuleConcatenationPlugin
,NoEmitOnErrorsPlugin
,OccurrenceOrderPlugin
,SideEffectsFlagPlugin
andTerserPlugin
.
Go to the simple-configuration
branch and run npm run dev
and npm run build
to see the differences in ./dist/main.js
.