新建 webpack.config.js
然后加入 如下代码
module.exports = (webpackConfig, env) => { // 别名配置 const data = webpackConfig.resolve.alias; webpackConfig.resolve.alias = { '@': `${__dirname}/src`, ...data } return webpackConfig }
然后就可以使用别名路径了