const path = require('path');
function resolve(dir) {
return path.join(__dirname, dir)
}
//导出路径
module.exports = {
chainWebpack: config => {
config.resolve.alias
.set("@", resolve("src"))
.set("assets", resolve("src/assets"))
.set("components", resolve("src/components"))
.set("imgs", resolve("src/assets/img"))
},
}
一般如果报错找不到路径 , 看看是不是没有安装path
安装指令
npm install path --save