mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 16:43:55 +00:00
dev: Improve template debugging in development
This commit is contained in:
parent
a5e16d2fe6
commit
031b0d58c8
@ -335,23 +335,28 @@ export default class Builder extends Tapable {
|
||||
this.options.build.watch.push(src)
|
||||
// Render template to dst
|
||||
const fileContent = await readFile(src, 'utf8')
|
||||
const template = _.template(fileContent, {
|
||||
imports: {
|
||||
serialize,
|
||||
hash,
|
||||
r,
|
||||
wp,
|
||||
wChunk,
|
||||
resolvePath: this.nuxt.resolvePath.bind(this.nuxt),
|
||||
relativeToBuild: this.relativeToBuild
|
||||
}
|
||||
})
|
||||
const content = template(Object.assign({}, templateVars, {
|
||||
options: options || {},
|
||||
custom,
|
||||
src,
|
||||
dst
|
||||
}))
|
||||
let content
|
||||
try {
|
||||
const template = _.template(fileContent, {
|
||||
imports: {
|
||||
serialize,
|
||||
hash,
|
||||
r,
|
||||
wp,
|
||||
wChunk,
|
||||
resolvePath: this.nuxt.resolvePath.bind(this.nuxt),
|
||||
relativeToBuild: this.relativeToBuild
|
||||
}
|
||||
})
|
||||
content = template(Object.assign({}, templateVars, {
|
||||
options: options || {},
|
||||
custom,
|
||||
src,
|
||||
dst
|
||||
}))
|
||||
} catch (err) {
|
||||
throw new Error(`Could not compile template ${src}: ${err.message}`)
|
||||
}
|
||||
const path = r(this.options.buildDir, dst)
|
||||
// Ensure parent dir exits
|
||||
await mkdirp(dirname(path))
|
||||
|
Loading…
Reference in New Issue
Block a user