2.5.18
https://github.com/kuoruan/pug-vue
npm installnpm run serverun success.
ERROR Failed to compile with 1 errors 5:35:13 PM
error in ./src/App.vue?vue&type=template&id=7ba5bd90&lang=pug&
Module build failed (from ./node_modules/pug-plain-loader/index.js):
Error: /Users/liao/Projects/Vue/pug-vue/src/App.vue:2:1
1|
> 2| #app
-------^
3| img(alt="Vue logo", src="./assets/logo.png")
4| HelloWorld(msg="Welcome to Your Vue.js App")
5|
unexpected token "indent"
at makeError (/Users/liao/Projects/Vue/pug-vue/node_modules/pug-error/index.js:32:13)
at Parser.error (/Users/liao/Projects/Vue/pug-vue/node_modules/pug-parser/index.js:53:15)
at Parser.parseExpr (/Users/liao/Projects/Vue/pug-vue/node_modules/pug-parser/index.js:264:14)
at Parser.parse (/Users/liao/Projects/Vue/pug-vue/node_modules/pug-parser/index.js:112:25)
at parse (/Users/liao/Projects/Vue/pug-vue/node_modules/pug-parser/index.js:12:20)
at Object.parse (/Users/liao/Projects/Vue/pug-vue/node_modules/pug/lib/index.js:125:22)
at Function.loadString [as string] (/Users/liao/Projects/Vue/pug-vue/node_modules/pug-load/index.js:45:21)
at compileBody (/Users/liao/Projects/Vue/pug-vue/node_modules/pug/lib/index.js:86:18)
at Object.exports.compile (/Users/liao/Projects/Vue/pug-vue/node_modules/pug/lib/index.js:242:16)
at Object.module.exports (/Users/liao/Projects/Vue/pug-vue/node_modules/pug-plain-loader/index.js:11:24)
@ ./src/App.vue?vue&type=template&id=7ba5bd90&lang=pug& 1:0-419 1:0-419
@ ./src/App.vue
@ ./src/main.js
@ multi (webpack)-dev-server/client?http://192.168.1.172:8080/sockjs-node (webpack)/hot/dev-server.js ./src/main.js
pug templates shouldn't start with an indent.
<template lang="pug">
#app
img(alt="Vue logo", src="./assets/logo.png")
HelloWorld(msg="Welcome to Your Vue.js App")
</template>
This will resolve the error. Earlier versions of Vue (maybe vue-template-compiler) seemed to be more tolerable about this (which I think it shouldn't because pug is indent-sensitive).
Most helpful comment
pugtemplates shouldn't start with an indent.This will resolve the error. Earlier versions of Vue (maybe
vue-template-compiler) seemed to be more tolerable about this (which I think it shouldn't becausepugis indent-sensitive).