Vue: pug failed to compile after update to vue 2.5.18

Created on 8 Dec 2018  路  1Comment  路  Source: vuejs/vue

Version

2.5.18

Reproduction link

https://github.com/kuoruan/pug-vue

Steps to reproduce

  • npm install
  • npm run serve

What is expected?

run success.

What is actually happening?

 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

Most helpful comment

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).

>All comments

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).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yyx990803 picture yyx990803  路  210Comments

asiFarran picture asiFarran  路  34Comments

yyx990803 picture yyx990803  路  36Comments

rpkilby picture rpkilby  路  50Comments

ferry77 picture ferry77  路  67Comments