mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15:13 +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)) {
|
||||
const bundle = fs.readFileSync(bundlePath, 'utf8')
|
||||
createRenderer.call(this, bundle)
|
||||
addAppTemplate.call(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -142,6 +143,16 @@ function * buildFiles () {
|
||||
webpackRunClient.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
|
||||
build.options.call(this) // Add build options
|
||||
this.build = () => co(build.build.bind(this))
|
||||
// Template
|
||||
if (!this.dev && this.renderer) {
|
||||
this.appTemplate = _.template(fs.readFileSync(resolve(this.dir, '.nuxt', 'dist', 'index.html'), 'utf8'), {
|
||||
interpolate: /{{([\s\S]+?)}}/g
|
||||
})
|
||||
}
|
||||
// Error template
|
||||
this.errorTemplate = _.template(fs.readFileSync(resolve(__dirname, 'views', 'error.html'), 'utf8'), {
|
||||
interpolate: /{{([\s\S]+?)}}/g
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user