diff --git a/lib/builder/builder.js b/lib/builder/builder.js index 91f3a66746..fd970b902f 100644 --- a/lib/builder/builder.js +++ b/lib/builder/builder.js @@ -30,7 +30,7 @@ export default class Builder { this.options = nuxt.options // Fields that set on build - this.compiler = null + this.compilers = [] this.webpackDevMiddleware = null this.webpackHotMiddleware = null @@ -408,23 +408,19 @@ export default class Builder { compilersOptions.push(dllWebpackConfig.call(this, clientConfig)) } - // Simulate webpack multi compiler interface - // Separate compilers are simpler, safer and faster - this.compilers = [] - // Initialize shared FS and Cache const sharedFS = this.options.dev && new MFS() const sharedCache = {} // Initialize compilers - compilersOptions.forEach(compilersOption => { + this.compilers = compilersOptions.map(compilersOption => { const compiler = webpack(compilersOption) // In dev, write files in memory FS (except for DLL) if (sharedFS && !compiler.name.includes('-dll')) { compiler.outputFileSystem = sharedFS } compiler.cache = sharedCache - this.compilers.push(compiler) + return compiler }) // Start Builds