mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-07 09:22:27 +00:00
dev: Improve template debugging in development
This commit is contained in:
parent
733168fdac
commit
dd7d8bbafc
@ -335,6 +335,8 @@ export default class Builder extends Tapable {
|
|||||||
this.options.build.watch.push(src)
|
this.options.build.watch.push(src)
|
||||||
// Render template to dst
|
// Render template to dst
|
||||||
const fileContent = await readFile(src, 'utf8')
|
const fileContent = await readFile(src, 'utf8')
|
||||||
|
let content
|
||||||
|
try {
|
||||||
const template = _.template(fileContent, {
|
const template = _.template(fileContent, {
|
||||||
imports: {
|
imports: {
|
||||||
serialize,
|
serialize,
|
||||||
@ -346,12 +348,15 @@ export default class Builder extends Tapable {
|
|||||||
relativeToBuild: this.relativeToBuild
|
relativeToBuild: this.relativeToBuild
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
const content = template(Object.assign({}, templateVars, {
|
content = template(Object.assign({}, templateVars, {
|
||||||
options: options || {},
|
options: options || {},
|
||||||
custom,
|
custom,
|
||||||
src,
|
src,
|
||||||
dst
|
dst
|
||||||
}))
|
}))
|
||||||
|
} catch (err) {
|
||||||
|
throw new Error(`Could not compile template ${src}: ${err.message}`)
|
||||||
|
}
|
||||||
const path = r(this.options.buildDir, dst)
|
const path = r(this.options.buildDir, dst)
|
||||||
// Ensure parent dir exits
|
// Ensure parent dir exits
|
||||||
await mkdirp(dirname(path))
|
await mkdirp(dirname(path))
|
||||||
|
Loading…
Reference in New Issue
Block a user