在 vue.config.js 文件添加
// module.exports上添加
const path = require('path');
function resolve(dir) {
return path.join(__dirname, dir)
}
module.exports = defineConfig({
// module.exports里添加
chainWebpack: config => {
// 配置别名
config.resolve.alias.set('@', resolve('src'))
},
})