diff --git a/lib/builder.js b/lib/builder.js index 710769b1c2..977c13f127 100644 --- a/lib/builder.js +++ b/lib/builder.js @@ -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 + }) } } diff --git a/lib/renderer.js b/lib/renderer.js index bead1a7796..5e21128016 100644 --- a/lib/renderer.js +++ b/lib/renderer.js @@ -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 + }) } }