// vue.config.js
const path = require('path');//引入path模块
function resolve(dir) {return path.join(__dirname, dir)
}
@默认代表src
configureWebpack: {resolve: {extensions: ['.js', '.vue', '.json'],alias: {'@': resolve('src'),'~': process.cwd(),public: resolve('public'),components: resolve('src/components'),util: resolve('src/utils'),store: resolve('src/store'),router: resolve('src/router')}}}
在HTML路径中使用别名,需要在引用前面加上"~"前缀。
其他文件使用