确保在项目更目录下面的Vue.config.js文件有如下配置

const path = require('path')
function resolve(dir) {
return path.join(__dirname, dir)
}
module.exports = {
     //...
    configureWebpack: {
      //...
      resolve: {
        alias: {
          '@': resolve('src')
        }
      }
      //...
    }
    //...
}
webstorm File > Settings > Languages & Frameworks > JavaScript > Webpack 下选择当前项目下的
"node_modules/@vue/cli-service/webpack.config.js"

wujh
9 声望1 粉丝