vue-cli4中如何在webpack中设置别名?

How to set the alias in webpack in vue-cli4?

vue-cli4中没有webpack.base.conf.js文件。如何设置别名? 谢谢

以根名称创建文件:vue.config.js

module.exports = {
  chainWebpack: config => {
    // path import to example
    const path = require('path')
    // path config.resolve.alias or config.resolve.alias.store
    config.resolve.alias = {
      ...config.resolve.alias,
      'myAlias': 'pathAlias || actionAlias',
      // My  Example
      'social': path.resolve(__dirname, '../Social')
    }
  }
}