创建多个包 webpack 热重载
Create multiple bundle web pack hot reload
我想用 webpack 热重载生成多个包:
我做的一个:
entry: [
'webpack-hot-middleware/client?reload=true',
path.join(__dirname, 'app/main.js')
],
但是对于多个我没有找到如何使用这一行:'webpack-hot-middleware/client?reload=true',
我试试这个:
entry: {
//'webpack-hot-middleware/client?reload=true', //This line is not accepted by webpack
firstbundle : path.join(__dirname, 'client/first.js'),
secondbundle : path.join(__dirname, 'client/second.js'),
thirdbundle : path.join(__dirname, 'client/third.js')
},
如何添加这一行?
您应该将 webpack-hot-middleware 传递给每个条目:
entry: {
firstbundle : ['webpack-hot-middleware/client?reload=true', path.join(__dirname, 'client/first.js')],
secondbundle : ['webpack-hot-middleware/client?reload=true', path.join(__dirname, 'client/second.js')],
thirdbundle : ['webpack-hot-middleware/client?reload=true', path.join(__dirname, 'client/third.js')]
},
我想用 webpack 热重载生成多个包:
我做的一个:
entry: [
'webpack-hot-middleware/client?reload=true',
path.join(__dirname, 'app/main.js')
],
但是对于多个我没有找到如何使用这一行:'webpack-hot-middleware/client?reload=true',
我试试这个:
entry: {
//'webpack-hot-middleware/client?reload=true', //This line is not accepted by webpack
firstbundle : path.join(__dirname, 'client/first.js'),
secondbundle : path.join(__dirname, 'client/second.js'),
thirdbundle : path.join(__dirname, 'client/third.js')
},
如何添加这一行?
您应该将 webpack-hot-middleware 传递给每个条目:
entry: {
firstbundle : ['webpack-hot-middleware/client?reload=true', path.join(__dirname, 'client/first.js')],
secondbundle : ['webpack-hot-middleware/client?reload=true', path.join(__dirname, 'client/second.js')],
thirdbundle : ['webpack-hot-middleware/client?reload=true', path.join(__dirname, 'client/third.js')]
},