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文件夹.

转载于:https://www.cnblogs.com/learnings/p/9042579.html

你可能感兴趣的:(javascript,webpack,前端)