1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
const createCompiler = (rawOptions) => { const options = getNormalizedWebpackOptions(rawOptions) applyWebpackOptionsBaseDefaults(options) const compiler = new Compiler(options.context) compiler.options = options new NodeEnvironmentPlugin({ infrastructureLogging: options.infrastructureLogging, }).apply(compiler) if (Array.isArray(options.plugins)) { for (const plugin of options.plugins) { if (typeof plugin === 'function') { plugin.call(compiler, compiler) } else { plugin.apply(compiler) } } } applyWebpackOptionsDefaults(options) compiler.hooks.environment.call() compiler.hooks.afterEnvironment.call() new WebpackOptionsApply().process(options, compiler) compiler.hooks.initialize.call() return compiler }
|