【问题标题】:How to fix Indent error in pug with vue js如何使用 vue js 修复 pug 中的缩进错误
【发布时间】:2022-07-03 23:49:56
【问题描述】:

我们有一个完整的项目网络,超过 15 个项目,每个项目都工作了三年以上。今天突然重装node模块后,到处出现错误:

Syntax Error: Error: C:\Users\veneg\Desktop\***\assets2\src\views\template\Socials.vue:2:1
    1|
  > 2|   .social
-------^
    3|     a.social__link.rtl(v-for="(soc, index) in socials" :key="index" :href="soc.link" target="blank")
    4|       icon(:name="soc.name" nofill)
    5|

unexpected token "indent"

项目中有超过 3000 个文件出现此错误,我该如何解决?

我尝试使用 pug loader 版本,但没有任何帮助。

我的版本:

"vue-loader": "~15.6",
    "vue-style-loader": "~4.1",
    "vue-template-compiler": "~2.6",
    "webpack": "~4.29",
    "webpack-bundle-analyzer": "~3.0",
    "webpack-cli": "~3.2",
    "webpack-dev-server": "~3.1",
    "webpack-hot-middleware": "~2.24",
    "webpack-merge": "~4.2"
    "@vue/cli-plugin-babel": "4.2.0",
    "@vue/cli-plugin-eslint": "4.2.0",
    "@vue/cli-service": "4.4.1",
    "@vue/eslint-config-airbnb": "5.0.2",
 "pug": "2.0.4",
    "pug-plain-loader": "1.0.0",

【问题讨论】:

  • 网上快速搜索了一下,vue eslint好像不支持pug。 Alpha 版中有这个包:npmjs.com/package/eslint-plugin-vue-pug
  • 你知道为什么会这样吗?毕竟 eslint 不在 package.json 依赖中。而且我根本没有他的配置。

标签: vue.js pug


【解决方案1】:

尝试使用@webdiscus/pug-loader,而不是pug-plain-loader

此加载器支持 Vue 模板中的缩进:

<template lang='pug'>
    h1 Hello Pug!
    p Text
</template>

请参阅 how to use Pug loader with Vuesource of example

【讨论】:

    猜你喜欢
    • 2022-11-21
    • 2021-08-11
    • 1970-01-01
    • 2019-04-07
    • 2014-05-01
    • 2022-11-21
    • 2019-08-25
    • 2022-06-10
    • 2022-11-17
    相关资源
    最近更新 更多