1. 配置文件目录:
build>webpack.base.config.js:
resolve: { alias: { '@': resolve('src'), //照猫画虎 'styles': resolve('src/asset/styles') } }
2. 于是一些长路径,如:
import '../../../../../../../styles/iconfont.css' --> import 'styles/iconfont.css'
@import '~@/assets/styels/header.css' --> @import '~styles/header.css'
3. 修改配置文件,不会热更新,所以重启项目,免得老报错