Skip to content

Commit e839b80

Browse files
committed
add hot reload client to all entry chunks
1 parent febca13 commit e839b80

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

template/build/webpack.dev.conf.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ var HtmlWebpackPlugin = require('html-webpack-plugin')
55
// eval-source-map is faster for development
66
config.devtool = 'eval-source-map'
77

8-
// add hot-reload related code to entry chunk
9-
config.entry.app = [
10-
'eventsource-polyfill',
11-
'webpack-hot-middleware/client?quiet=true',
12-
config.entry.app
13-
]
8+
// add hot-reload related code to entry chunks
9+
var polyfill = 'eventsource-polyfill'
10+
var hotClient = 'webpack-hot-middleware/client?quiet=true'
11+
Object.keys(config.entry).forEach(function (name, i) {
12+
var extras = i === 0 ? [polyfill, hotClient] : [hotClient]
13+
config.entry[name] = extras.concat(config.entry[name])
14+
})
1415

1516
// necessary for the html plugin to work properly
1617
// when serving the html from in-memory

0 commit comments

Comments
 (0)