Vue3 Vite 配置别名问题报错,导致报无法找到对应模块错误的处理解决方式
错误配置
const path = require('path')
export default defineConfig({
resolve: {
alias: {
"/@/": path.resolve(__dirname, "src");,
},
...
}
}
正确的配置
const path = require('path')
export default defineConfig({
resolve: {
alias: [
{
find: "@",
replacement: path.resolve(__dirname, 'src')
}
],
...
}
}