打开 build/webpack.base.conf.js ,在module.exports .resolve.alias下自定义:
alias: {
'vue$': 'vue/dist/vue.esm.js',
'@': resolve('src'),
'assets':resolve('src/assets'),
'components':resolve('src/components')
}
然后就可以在js中直接使用assets/xxx或components/xxx了:
import HelloWorld from 'components/HelloWorld'