1 |
|
2 |
|
3 |
|
4 |
|
5 | "use strict";
|
6 |
|
7 | const Compiler = require("./Compiler");
|
8 | const WebEnvironmentPlugin = require("./web/WebEnvironmentPlugin");
|
9 | const WebpackOptionsApply = require("./WebpackOptionsApply");
|
10 | const WebpackOptionsDefaulter = require("./WebpackOptionsDefaulter");
|
11 |
|
12 | const webpack = (options, callback) => {
|
13 | new WebpackOptionsDefaulter().process(options);
|
14 |
|
15 | const compiler = new Compiler();
|
16 | compiler.options = new WebpackOptionsApply().process(options, compiler);
|
17 | new WebEnvironmentPlugin(
|
18 | options.inputFileSystem,
|
19 | options.outputFileSystem
|
20 | ).apply(compiler);
|
21 | if (callback) {
|
22 | compiler.run(callback);
|
23 | }
|
24 | return compiler;
|
25 | };
|
26 | module.exports = webpack;
|
27 |
|
28 | webpack.WebpackOptionsDefaulter = WebpackOptionsDefaulter;
|
29 | webpack.WebpackOptionsApply = WebpackOptionsApply;
|
30 | webpack.Compiler = Compiler;
|
31 | webpack.WebEnvironmentPlugin = WebEnvironmentPlugin;
|