File tree Expand file tree Collapse file tree 3 files changed +11
-8
lines changed
Expand file tree Collapse file tree 3 files changed +11
-8
lines changed Original file line number Diff line number Diff line change 11## Webpack4 - React16.7 Templater App
22
33
4+ # 2.1.2
5+ * Fixed HMR work in development mode.
6+
47# 2.1.1
58 * Update UjlifyJS plugin correspond to its internal update.
69 * Improved distinguish between prod and dev version running via Hot Module Replacement.
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ const bundler = webpack(webpackConfig);
1515// ========================================================
1616const devMiddlewareOptions = {
1717 publicPath : webpackConfig . output . publicPath ,
18- hot : globals . __DEV__ ? true : false ,
18+ hot : __DEV__ ? true : false ,
1919 headers : { 'Access-Control-Allow-Origin' : '*' }
2020} ;
2121
@@ -24,7 +24,7 @@ const devMiddlewareOptions = {
2424// ========================================================
2525const webpackMiddleware = [ webpackDevMiddleware ( bundler , devMiddlewareOptions ) ] ;
2626
27- if ( globals . __DEV__ ) {
27+ if ( __DEV__ ) {
2828 webpackMiddleware . push ( webpackHotMiddleware ( bundler ) ) ;
2929}
3030
Original file line number Diff line number Diff line change @@ -213,13 +213,13 @@ const createConfig = () => {
213213 // ------------------------------------
214214 // Entry Points
215215 // ------------------------------------
216- const appEntryPoint = [ 'babel-polyfill' , path . resolve ( __dirname , 'src/index.js' ) ] ;
216+ const appEnterPrefixPlugins = [ 'babel-polyfill' ] ;
217+ const appPath = path . resolve ( __dirname , 'src/index.js' ) ;
218+ const appEntryPoint = [ ...appEnterPrefixPlugins , appPath ] ;
217219
218- if ( __DEV__ ) {
219- const HMRPath = 'webpack-hot-middleware/client?path=/__webpack_hmr' ;
220-
221- appEntryPoint [ 1 ] . concat ( HMRPath ) ;
222- }
220+ webpackConfig . entry = {
221+ app : __DEV__ ? appEntryPoint . concat ( 'webpack-hot-middleware/client?path=/__webpack_hmr' ) : appEntryPoint
222+ } ;
223223
224224 webpackConfig . entry = {
225225 app : appEntryPoint
You can’t perform that action at this time.
0 commit comments