mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 16:12:12 +00:00
Fix template not built
This commit is contained in:
parent
8dfae9fa54
commit
591ef50a06
11
lib/build.js
11
lib/build.js
@ -101,6 +101,7 @@ export function options () {
|
|||||||
if (fs.existsSync(bundlePath)) {
|
if (fs.existsSync(bundlePath)) {
|
||||||
const bundle = fs.readFileSync(bundlePath, 'utf8')
|
const bundle = fs.readFileSync(bundlePath, 'utf8')
|
||||||
createRenderer.call(this, bundle)
|
createRenderer.call(this, bundle)
|
||||||
|
addAppTemplate.call(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -142,6 +143,16 @@ function * buildFiles () {
|
|||||||
webpackRunClient.call(this),
|
webpackRunClient.call(this),
|
||||||
webpackRunServer.call(this)
|
webpackRunServer.call(this)
|
||||||
]
|
]
|
||||||
|
addAppTemplate.call(this)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function addAppTemplate () {
|
||||||
|
let templatePath = resolve(this.dir, '.nuxt', 'dist', 'index.html')
|
||||||
|
if (fs.existsSync(templatePath)) {
|
||||||
|
this.appTemplate = _.template(fs.readFileSync(templatePath, 'utf8'), {
|
||||||
|
interpolate: /{{([\s\S]+?)}}/g
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,12 +84,7 @@ class Nuxt {
|
|||||||
// Add this.build
|
// Add this.build
|
||||||
build.options.call(this) // Add build options
|
build.options.call(this) // Add build options
|
||||||
this.build = () => co(build.build.bind(this))
|
this.build = () => co(build.build.bind(this))
|
||||||
// Template
|
// Error template
|
||||||
if (!this.dev && this.renderer) {
|
|
||||||
this.appTemplate = _.template(fs.readFileSync(resolve(this.dir, '.nuxt', 'dist', 'index.html'), 'utf8'), {
|
|
||||||
interpolate: /{{([\s\S]+?)}}/g
|
|
||||||
})
|
|
||||||
}
|
|
||||||
this.errorTemplate = _.template(fs.readFileSync(resolve(__dirname, 'views', 'error.html'), 'utf8'), {
|
this.errorTemplate = _.template(fs.readFileSync(resolve(__dirname, 'views', 'error.html'), 'utf8'), {
|
||||||
interpolate: /{{([\s\S]+?)}}/g
|
interpolate: /{{([\s\S]+?)}}/g
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user