打開 build/webpack.base.conf.js ,在module.exports .resolve.alias下自定義:vue
alias: { 'vue$': 'vue/dist/vue.esm.js', '@': resolve('src'), 'assets':resolve('src/assets'), 'components':resolve('src/components') }
而後就能夠在js中直接使用assets/xxx或components/xxx了:webpack
import HelloWorld from 'components/HelloWorld'