-
Notifications
You must be signed in to change notification settings - Fork 518
Webpack Dev Middleware not working (HMR and React HMR) #1133
Comments
Could you try this with the latest .NET Core 2.0 Preview 3 templates? These will be shipping as finished products very soon, so all ongoing work will be happening there rather than in the old Yeoman templates.
With this setup, you don't need to manually change any NPM packages as all the dependencies are already correct. I've verified this works, but please let me know if you hit any issues. |
Thanks! Do you by chance have root access? I think I can get around this second issue by following #7119 at dotnet/cli, but for everyone else's sake, on first try I'm having some permissions issues that you all might run into as well: Following the steps from Steve above, when I run
I'm having this problem with both the pkg installer and the tar.gz. I can See #7119 at dotnet/cli for more info. The fix appears to be in 2.0.0-preview3-6736. |
We are having the same issue for angular template, however for our existing project. When creating a new template, as @SteveSandersonMS suggests, it works fine.
// output
if (false) {
module.hot.accept(); Is there anything I can check? In order to understand why the HMR scripts are not there. |
After some hours of debugging I managed to find something, basically we had: JsonConvert.DefaultSettings = () => new JsonSerializerSettings
{
Formatting = Formatting.Indented,
ContractResolver = new CamelCasePropertyNamesContractResolver()
}; Which caused to change properties for the webpack server when it initializes, and ts code is expecting them to be PascalCased rather than camelcas'ed. Perhaps I can open an issue there and improve that a bit |
Any update in this issue? |
It sounds like both @jzb3db and @stephenlautier have described their resolutions. @remware, if you have an issue, could you please post a new issue with repro steps for your specific case? |
Hi, I could not get above resolution, it was not clear what code needs to be patched or what updated version to use. As per steps to reproduce I have basic VS2017 Update 15.3.1, dotnet core 1.1.2 ( 2.0 installed but not targetted ), Node v6.11.0, webpack 2.5.1, aspnet-webpack 1.0.29, webpack-hot-middleware 2.18.0. The way I get over the issue was to install webpack globally and then execute deployment in VS2017 webdeploy. Not sure how to reproduce it. |
Hi @remware, while I did find a workaround by promoting my permissions, there might still be an issue with the package installer. Ideally, nobody would have to mess with their own permissions to get this to work. To that point, @livarcocc shed light on the root cause of the issue we're having in #7119 at dotnet/cli, and suggests we try again with a more recent build. He explains that in the pkg installer, I have not yet had the chance to test these new builds out, but as soon as I find the time I'll give it a shot and report back. |
This issue is very similar to closed issue #422, which unfortunately was unable to solve my problem. In #422, the fix was to update Node, but I already have a stable version of Node more recent than the one listed in #422.
My environment
macOS Sierra v10.12.5
VS Code v1.14.1
Node.js v6.10.0
.NET Core SDK, which contains .NET Core 1.0 and 1.1
Steps to reproduce (some steps copied from the README):
Install Yeoman and these generator templates:
Generate your new application starting point:
This command should fail during the build process, which you can fix by following issues #1120 and #1099. I also referenced these issues in #1132. In summary, you'll probably need to install more recent versions of some npm packages, including
typescript
and some@types/
.Make sure that your Startup.cs file contains a block of code similar to the following, to make sure HMR will be in place during development mode:
Once the generator has run successfully (and if it hasn't, once you've successfully installed stable dependencies), you can start up the app. Before running, though, make sure you're running the app in development mode so that the app will use webpack dev middleware. Start up the app with:
Open a browser (I've been using Chrome) and navigate to the correct localhost port. Open a file in the ClientApp directory, like components/Home.tsx and change something simple. When you save the file, in your terminal you should see something like:
Flip back to the browser and reload the page. For me, the change does not appear, and I don't think Node ever rebuilt the ClientApp code using webpack.
The only way I can get the change to take place is if I run webpack manually from the terminal.
Any thoughts?
The text was updated successfully, but these errors were encountered: