Skip to content
This repository has been archived by the owner on Dec 26, 2018. It is now read-only.

Commit

Permalink
better template error warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Jun 15, 2016
1 parent 0ec591d commit 3301ec7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,10 @@ function processTemplate (part, filePath, parts) {
.then(function (res) {
var compiled = vueCompiler.compile(res)
if (compiled.errors.length) {
throw new Error(compiled.errors.join('\n\n'))
compiled.errors.forEach(function (msg) {
console.error('\n' + chalk.red(msg) + '\n')
})
throw new Error('Vue template compilation failed')
} else {
parts.template = {
render: toFunction(compiled.render),
Expand Down Expand Up @@ -190,10 +193,10 @@ function loadSrc (src, filePath) {
try {
return fs.readFileSync(filePath, 'utf-8')
} catch (e) {
console.warn(
console.error(chalk.red(
'Failed to load src: "' + src +
'" from file: "' + filePath + '"'
)
))
}
}

Expand Down

0 comments on commit 3301ec7

Please sign in to comment.