project architecture
Vue3 + element-plus + echarts + axios + Gaode map + sass

plug-in package
amfe-flexible + postcss-pxtorem、vuex-persistedstate、sass-loader

Create premise
1. Upgrade the scaffolding to the latest
2. Upgrade npm to the latest
Note: Operate with administrator rights

npm i -g npm
cnpm i -g cnpm

error/warning

error: 'XXX' is defined but never used (no-unused-vars)

//解决方法:package.json 中添加
"rules": {
   "generator-star-spacing": "off",
   "no-tabs":"off",
   "no-unused-vars":"off",
   "no-console":"off",
   "no-irregular-whitespace":"off",
   "no-debugger": "off"
}
 Error: PostCSS plugin postcss-pxtorem requires PostCSS 8.”
 //解决办法,降级为:"postcss-pxtorem": "^5.1.1",
 Error: Cannot find module 'vue-loader-v16/package.json'
 //把 cnpm 安装换成 npm 安装
"export 'default' (imported as 'echarts') was not found in 'echarts'
//改成  import * as echarts from "echarts";
  sass-loader 
  //版本改成 "sass-loader": "^7.1.1"
报错:The template root requires exactly one element
原因:不支持多个根元素
/*
  .eslintrc.js 文件中,把 extends 中的 "plugin:vue/essential",改成"plugin:vue/vue3-essential"
*/

九霄
157 声望14 粉丝

记录开发以来,遇到的一些问题...