mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 16:12:12 +00:00
prevent calling init multi times
This commit is contained in:
parent
36c1deda17
commit
17d0082861
@ -49,7 +49,10 @@ export default class Builder extends Tapable {
|
||||
this._init = this.init().catch(this.nuxt.errorHandler)
|
||||
} else {
|
||||
// Wait for hook
|
||||
this.nuxt.plugin('init', this.init.bind(this))
|
||||
this.nuxt.plugin('init', () => {
|
||||
this._init = this.init()
|
||||
return this._init
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,17 +28,18 @@ export default class Renderer extends Tapable {
|
||||
this.nuxt = nuxt
|
||||
this.options = nuxt.options
|
||||
|
||||
// Will be loaded by createRenderer
|
||||
// Will be set by createRenderer
|
||||
this.bundleRenderer = null
|
||||
this.renderToStream = null
|
||||
this.renderToString = null
|
||||
|
||||
if (nuxt.initialized) {
|
||||
// If nuxt already initialized
|
||||
this._init = this.init().catch(this.nuxt.errorHandler)
|
||||
} else {
|
||||
// Wait for hook
|
||||
this.nuxt.plugin('init', this.init.bind(this))
|
||||
this.nuxt.plugin('init', () => {
|
||||
this._init = this.init()
|
||||
return this._init
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user