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

Commit 3301ec7

Browse files
committed
better template error warnings
1 parent 0ec591d commit 3301ec7

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/compiler.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,10 @@ function processTemplate (part, filePath, parts) {
147147
.then(function (res) {
148148
var compiled = vueCompiler.compile(res)
149149
if (compiled.errors.length) {
150-
throw new Error(compiled.errors.join('\n\n'))
150+
compiled.errors.forEach(function (msg) {
151+
console.error('\n' + chalk.red(msg) + '\n')
152+
})
153+
throw new Error('Vue template compilation failed')
151154
} else {
152155
parts.template = {
153156
render: toFunction(compiled.render),
@@ -190,10 +193,10 @@ function loadSrc (src, filePath) {
190193
try {
191194
return fs.readFileSync(filePath, 'utf-8')
192195
} catch (e) {
193-
console.warn(
196+
console.error(chalk.red(
194197
'Failed to load src: "' + src +
195198
'" from file: "' + filePath + '"'
196-
)
199+
))
197200
}
198201
}
199202

0 commit comments

Comments
 (0)