首页 > 代码库 > webpack配置技巧--路径

webpack配置技巧--路径

resolve: {
extensions: [‘‘, ‘.js‘, ‘.vue‘],
fallback: [path.join(__dirname, ‘../node_modules‘)],
alias: {
‘vue$‘: ‘vue/dist/vue.common.js‘,
‘src‘: path.resolve(__dirname, ‘../src‘),
‘assets‘: path.resolve(__dirname, ‘../src/assets‘),
‘components‘: path.resolve(__dirname, ‘../src/components‘)
}
},


‘components‘: path.resolve(__dirname, ‘../src/components‘)为例:
路径可以直接写‘components/.......‘
不用再‘./components/...‘这样一级一级目录去找了

webpack配置技巧--路径