mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 22:25:12 +00:00
set this.resources in constructor
Prevent error when access methods earlier than init is called
This commit is contained in:
parent
4569b3a46f
commit
de51b8a6da
@ -31,6 +31,14 @@ export default class Renderer extends Tapable {
|
||||
// Will be set by createRenderer
|
||||
this.bundleRenderer = null
|
||||
|
||||
// Renderer runtime resources
|
||||
this.resources = {
|
||||
clientManifest: null,
|
||||
serverBundle: null,
|
||||
appTemplate: null,
|
||||
errorTemplate: parseTemplate(fs.readFileSync(resolve(__dirname, 'views', 'error.html'), 'utf8'))
|
||||
}
|
||||
|
||||
if (nuxt.initialized) {
|
||||
// If nuxt already initialized
|
||||
this._init = this.init().catch(this.nuxt.errorHandler)
|
||||
@ -48,14 +56,6 @@ export default class Renderer extends Tapable {
|
||||
return this._init
|
||||
}
|
||||
|
||||
// Renderer runtime resources
|
||||
this.resources = {
|
||||
clientManifest: null,
|
||||
serverBundle: null,
|
||||
appTemplate: null,
|
||||
errorTemplate: parseTemplate(fs.readFileSync(resolve(__dirname, 'views', 'error.html'), 'utf8'))
|
||||
}
|
||||
|
||||
// For serving static/ files to /
|
||||
this.serveStatic = pify(serveStatic(resolve(this.options.srcDir, 'static'), this.options.render.static))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user