a webpack overview for webpack developers
-
Validate webpack.config Schema (using 'ajv')*
-
form
Compiler instance
- webpack.config === Array ==>
MultiCompiler
- webpack.config ==>
Compiler
run Compiler
- if watchMode is true, run
compiler.watch(watchOptions, callback);
-
this.applyPluginsAsync("before-run", this, err => { step2 })
-
this.applyPluginsAsync("run", this, err => { step3 })
-
this.readRecords(err => { step4 });
-
this.applyPluginsAsync("before-compile", params, err => { step5 })
this.applyPlugins("compile", params); const compilation = this.newCompilation(params);
step6
-
this.applyPluginsParallel("make", compilation, err => { step7 }
-
compilation.finish(); compilation.seal(err => { step8 })
-
this.applyPluginsAsync("after-compile", compilation, err => { step9 })
- if(this.applyPluginsBailResult("should-emit", compilation) === false)
if(this.applyPluginsBailResult("should-emit", compilation) === false) {
this.applyPlugins("done", stats);
return callback(null, stats);
}
- else
this.emitAssets(compilation, err => {
if(compilation.applyPluginsBailResult("need-additional-pass")) {
this.applyPluginsAsync("additional-pass", err => {
if(err) return callback(err);
this.compile(onCompiled);
});
}
this.emitRecords(err => {
if(err) return callback(err);
const stats = new Stats(compilation);
stats.startTime = startTime;
stats.endTime = Date.now();
this.applyPlugins("done", stats);
return callback(null, stats);
});
})
-
before-run
-
run
-
before-compile
-
compile [S]
-
make [P]
-
after-compile
-
should-emit [S]
8.2 true
8.2.1 need-additional-pass 8.2.2 additional-pass
- done