filename檔案名稱修正

若有多個entry時,
就將webpack.config裡的entry調整成object的形式

原先entry:

1
entry: './index.js ’// 進入點

修改後entry:

1
2
3
4
5
entry: {
// key: value
index: ‘./index.js',
about: ‘./about.js'
},

原先output

1
2
3
4
output: {
path: path.resolve(__dirname, "./dist"),
filename: 'index-bundle.js’
}

修改後output

1
2
3
4
5
6
!!!
[name] =>> 依照entry的key的名稱
output: {
path: path.resolve(__dirname, "./dist"),
filename: '[name]-bundle.js’
}