Merge pull request #57 from laskoviymishka/unshift-issue

Fix issue: entry.main.unshift is not a function Closes #56
This commit is contained in:
Steve Sanderson
2016-05-02 10:54:54 -07:00

View File

@@ -40,7 +40,11 @@ export function createWebpackDevServer(callback: CreateDevServerCallback, option
// Build the final Webpack config based on supplied options // Build the final Webpack config based on supplied options
if (enableHotModuleReplacement) { if (enableHotModuleReplacement) {
// TODO: Stop assuming there's an entry point called 'main' // TODO: Stop assuming there's an entry point called 'main'
webpackConfig.entry['main'].unshift('webpack-hot-middleware/client'); if (typeof webpackConfig.entry['main'] === 'string') {
webpackConfig.entry['main'] = ['webpack-hot-middleware/client', webpackConfig.entry['main']];
} else {
webpackConfig.entry['main'].unshift('webpack-hot-middleware/client');
}
webpackConfig.plugins.push( webpackConfig.plugins.push(
new webpack.HotModuleReplacementPlugin() new webpack.HotModuleReplacementPlugin()
); );