在vue.confg.js中添加如下代码,如果没有这个文件,在根目录创建一个
const path = require('path');
//拼接路径
function resolve(dir) {
return path.join(__dirname, dir)
}
module.exports = {
chainWebpack: (config) => {
config.resolve.alias
.set('@', resolve('src'))
.set('@components', resolve('src/components'))
.set('@static', resolve('src/static'))
},
}
原文地址:https://www.cnblogs.com/imjtzhang/p/12015679.html
时间: 2024-10-09 17:25:35