mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15:13 +00:00
refactor: simplify internal compilers
This commit is contained in:
parent
fe69b71631
commit
f626acf1f9
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user