refactor(builder): make plugins in BuildContext update dynamically (#4280)

This commit is contained in:
Clark Du 2018-11-06 12:53:15 +00:00 committed by Pooya Parsa
parent 3f2b10ea0c
commit 3953eef271
2 changed files with 7 additions and 3 deletions

View File

@ -207,8 +207,8 @@ export default class Builder {
async generateRoutesAndFiles() {
consola.debug(`Generating nuxt files`)
this.plugins.length = 0
this.plugins.push.apply(this.plugins, this.normalizePlugins())
// Plugins
this.plugins = Array.from(this.normalizePlugins())
// -- Templates --
let templatesFiles = Array.from(this.template.templatesFiles)

View File

@ -1,8 +1,12 @@
export default class BuildContext {
constructor(builder) {
this._builder = builder
this.nuxt = builder.nuxt
this.options = builder.nuxt.options
this.isStatic = false
this.plugins = builder.plugins
}
get plugins() {
return this._builder.plugins
}
}