-
Notifications
You must be signed in to change notification settings - Fork 519
Updating aspnet-webpack-react to work with react-hot-loader v4 #1675
Conversation
…er/patch' as it was removed in v4 of react-hot-loader. Bumping peer dependency of webpack to 3 and 4
@natemcmaster I'll look at releasing this. Note that since it's purely a change to an NPM package, it doesn't need to be in any ASP.NET Core release milestone. We can ship NPM package changes at any time; they don't go into ASP.NET Core releases. @tjaskula Since you're dropping support for Webpack 2 and 3, by removing the |
Thanks for taking a look @SteveSandersonMS. Side note: I was playing around with this over the weekend at seemed to me like improvements to react-hot-loader and webpack 4 make aspnet-webpack-react unnecessary. I got hmr working just fine without it. I'm not proposing anything...just pointing out that I couldn't figure out what aspnet-webpack-react was supposed to do. |
@natemcmaster Were you using the SPA templates from ASP.NET Core 2.0 or later? If so, you're not using |
I see, makes sense. I was setting up hmr with ASP.NET Core 2.1 on an old hobby project I was upgrading from ASP.NET 4. I didn't see HMR in the latest SPA templates so wasn't sure what to do. |
@SteveSandersonMS Thanks for suggestions. I'll target Webpack 4 only which will be related to the changes. |
@tjaskula yes. It may require updating to the latest versions of webpack and react-hot-loader, but I got it working just fine without aspnet-webpack-react. I wrote up a quick demo and post about this https://natemcmaster.com/blog/2018/07/05/aspnetcore-hmr/ |
@natemcmaster I checked what was different in my configuration and realized that in ASP.NET Core I had this configuration:
Notice the flag When I comment out My point is that, if you're using ASP.NET Core 2.1, just go without For ASP.NET Core < 2.0 this PR might be of value. I'm making changes to the PR as requested above. |
@tjaskula Thanks for clearing this up. Removing aspnet-webpack-react and REactHotMudleReplacement = true resolved my error and HMR still functions as expected. |
@natemcmaster do sourcemaps works for you ? I noticed that for me it doesn't load properly in Chrome |
Yeah, I got those working with the inline-source-map devtool and awesome-typescript-loader. |
All is ok, I was using webpack.SourceMapdevtoolPlugin which seems broken. Swtiching to detool: inline-source-map seems fixing the issue. |
… 4 as peerDependency. Bumping up dev dependencies too.
I've pushed the required changes. Please review if this is ok. |
Really need this one. What's the eta for reviewing this PR? |
Thanks for the prompt. This is now merged and published as |
This should solve the issue #1585
react-hot-loader/webpack
andreact-hot-loader/patch
as it was removed in v4 of react-hot-loader. Referencingreact-hot-loader/babel
in webpack configuration is enough.