Tentative webpack course series:
- (publishing soon) Webpack: Transpiling and Bundling JavaScript
- (tentative) Webpack: Beyond JavaScript
- (tentative) Webpack: Bundle Optimization
Tentative means not set in stone.
- Course #1 uses webpack v3. Tentatively there will be a guide about upgrading from webpack v3 to v4 in Course #2.
- Course #2 and #3 will be created after webpack v4 RTM.
- Course #1 is bundling and transpiling JavaScript.
- Course #2 is bundling and transpiling/compiling everything else in a front end app: styles, layouts, images, webassembly, etc.
- Course #3 is then about optimizing the bundles!
Check here for notes about updates to webpack that are related to materials covered in the course series
- webpack v4 (based on latest alpha.5)
- Nothing has fundamentally changed in webpack v4 that obviates what was covered in Course #1.
- CLI extracted to new
webpack-cli
package- Just
npm install webpack-cli
instead ofnpm install webpack
webpack
package will only provide the API- See redirection in webpack package's
bin\webpack.js
- Just
entry
defaults to./src
output.path
defaults to absolute path to./dist
- New, required
mode
config adds common optimization plugins- This is simply a new configuration style!
- Matching
--mode
CLI argument - Intended to be
production
ordevelopment
to optimize accordingly - Coarse
mode
maps to new, granularoptimization.*
settings. Most of these are flags to enable/disable a plugin.- See
mode
=>optimization.*
mapping inWebpackOptionsDefaulter.js
(search formode
) - See
optimization.*
=> plugins mapping inWebpackOptionsApply.js
(search foroptimization
)
- See
- To use webpack v4 with Course #1 set
mode: "none"
to disable this new configuration style.- All you're doing is turning off some webpack features, notably bundle optimization. Doing this is helpful to learn what is going on under the hood. You can incrementally add back optimizations and look at the bundle impact one at a time.
- This is likely how I will teach going forward even with v4.
- Most of the optimization plugins won't be covered until Course #3 so this is largely irrelevant. The following new flags relate to topics covered in Course #1
if mode == 'development'
: - This new
mode
compliments techniques shown in Course #1'sDev Isn't Prod
module.