vue2.0中配置文件路径
在build/webpack.base.conf.js中添加一些代码即可
module.exports = {
resolve: {
extensions: ['.js', '.vue', '.json'],
alias: {
'vue$': 'vue/dist/vue.esm.js',
'@': resolve('src'),
'components':path.resolve(__dirname,'../src/components'),
'pages':path.resolve(__dirname,'../src/pages'),
}
},
在module.export中的resolve中添加:
'components':path.resolve(__dirname,'../src/components'),
'pages':path.resolve(__dirname,'../src/pages'),
以后在组件中写components代表的路径就是src/components文件夹.