From 754e32b604f5dc9f7422116f7e35a250dfabb63d Mon Sep 17 00:00:00 2001 From: Andrei Tserakhau Date: Fri, 29 Apr 2016 14:05:50 +0300 Subject: [PATCH] Fix Webpack default entry issue: webpackConfig.entry.main.unshift is not a function Closes #56 --- .../npm/aspnet-webpack/src/WebpackDevMiddleware.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.AspNet.SpaServices/npm/aspnet-webpack/src/WebpackDevMiddleware.ts b/src/Microsoft.AspNet.SpaServices/npm/aspnet-webpack/src/WebpackDevMiddleware.ts index 10c78bd..d7717d3 100644 --- a/src/Microsoft.AspNet.SpaServices/npm/aspnet-webpack/src/WebpackDevMiddleware.ts +++ b/src/Microsoft.AspNet.SpaServices/npm/aspnet-webpack/src/WebpackDevMiddleware.ts @@ -40,7 +40,11 @@ export function createWebpackDevServer(callback: CreateDevServerCallback, option // Build the final Webpack config based on supplied options if (enableHotModuleReplacement) { // 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( new webpack.HotModuleReplacementPlugin() );