error Replace `'element-plus'` with `"element-plu

vue / 202人浏览 / 0人评论

vue3在前期开发的过程中,引入了element-plus的时候报了这个错误,网上看了一下事因为前期开发过程中, 发现是eslint的错误,其实没有错,只不过Vue检测你的组件名称不符合就不编译了。

报错

Compiled with problems:
ERROR
[eslint] 
/Users/lee/MAMP PRO/vuestudy/vuecompany/company1/vue3-element-admin/src/main.js
  8:25  error  Replace `'element-plus'` with `"element-plus";`                                 prettier/prettier
  9:8   error  Replace `'element-plus/dist/index.css'⏎` with `"element-plus/dist/index.css";`  prettier/prettier

✖ 2 problems (2 errors, 0 warnings)
  2 errors and 0 warnings potentially fixable with the `--fix` option.

解决方案

修改vue.config.js 文件配置

const { defineConfig } = require('@vue/cli-service')

module.exports = defineConfig({

  transpileDependencies: true,

  lintOnSave: false #加入这一行,把报错屏蔽掉

})

然后关掉vue服务,重新启动运行即可不报错

yarn serve

输入图片说明

评论列表

还没有人发表评论

发表评论 取消回复