// 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')
}
}
}
其他文件使用