-
Notifications
You must be signed in to change notification settings - Fork 519
Webpack middleware/HMR errors or times out if multiple tabs open to localhost #1180
Comments
This is likely an issue with VS debugging getting in the way of HMR, or vice versa - I am able to open multiple (> 3) tabs to localhost when running the react/redux/asp.net app. I am able to reload each tab independently without error and updates to my components are being pushed without issue. I am using a mac and VS Code currently. I am happy to try this on my Windows machine w/ VS 2017 tomorrow to see what that brings while attached and debugging. Have you tried just spinning up the project with command line to get Visual Studio out of the way? |
I currently am unable to run our app using |
I went over to one of our other teams that is able to run their app on the command line with |
This might potentially be simply a webpack/HMR issue as there are multiple web socket connections to each one of these browsers running the project. Do you have multiple open simply to test a site in different browsers simultaneously? |
@MarkPieszak Actually the scenario we encounter regularly is just using one browser (usually Chrome) with multiple tabs. What I was doing when I realized the problem was multiple-tab-related was I had duplicated the tab so that I could jump back and forth between tabs where each tab was on a different page so I could compare. As soon as I did that, bundles stopped building, or at least slowed down to a completely unacceptable crawl (minutes). |
Care to upload your package.json? Curious to see if you're on some versions of things that bring this error to light. I am running the most recent version of the SPA templates. I have made a couple changes to versions in my package.json to accommodate some of the recent changes to these templates. I'll try to spin up a project with your package.json and see what happens. |
"devDependencies": {
"@types/bootstrap": "^3.3.34",
"@types/jquery": "^3.2.5",
"@types/material-ui": "^0.17.14",
"@types/react": "^15.6.0",
"@types/react-dom": "^15.5.1",
"@types/react-hot-loader": "^3.0.3",
"@types/react-router": "^4.0.12",
"@types/react-router-dom": "^4.0.5",
"@types/react-select": "^1.0.48",
"@types/toastr": "^2.1.34",
"@types/webpack": "^3.0.4",
"@types/webpack-env": "^1.13.0",
"@types/webpack-hot-middleware": "^2.15.0",
"aspnet-webpack": "^2.0.1",
"aspnet-webpack-react": "^3.0.0",
"awesome-typescript-loader": "^3.1.3",
"copy-webpack-plugin": "^4.0.1",
"css-loader": "^0.28.4",
"cssnano": "^3.10.0",
"extract-text-webpack-plugin": "^2.1.2",
"node-sass": "^4.5.3",
"optimize-css-assets-webpack-plugin": "^2.0.0",
"raw-loader": "^0.5.1",
"react-hot-loader": "^3.0.0-beta.7",
"sass-loader": "^6.0.6",
"style-loader": "^0.18.2",
"typescript": "^2.4.1",
"webpack": "^2.7.0",
"webpack-hot-middleware": "^2.18.2"
},
"dependencies": {
"bootstrap": "^3.3.7",
"chart.js": "^2.6.0",
"jquery": "^3.2.1",
"material-ui": "^0.18.5",
"react": "^15.6.1",
"react-dom": "^15.6.1",
"react-router": "^4.1.1",
"react-router-dom": "^4.1.1",
"react-select": "^1.0.0-rc.5",
"react-tap-event-plugin": "^2.0.1",
"redux": "^3.7.1",
"rigby": "^1.5.2",
"toastr": "^2.1.2"
} |
I am still not able to duplicate this - I am just using the kestrel server for local development. I could speculate wildly about what I think the issue is but I don't want to lead you astray 😃 |
Thanks @android2221 for trying to debug this. I've been trying to repro it too, but without success. I set up an app that takes 10s to complete its webpack build, using the React-Redux template, using @paulirwin If you're able to track down a minimal repro that surfaces this issue I'd be happy to have a look. Besides that I'm not sure there are other actions I can take on this :( |
@SteveSandersonMS Thanks for looking into this. Do you know of any open-source repos I can try to reproduce this on? Another variable I thought of is that both of our projects where we have this issue have multiple entry points so multiple bundles loaded on the page. I'll see if I can come up with an equivalent example and try to reproduce. |
I upgraded our site to use ASP.NET Core 2.0 including SpaServices 2.0 and this issue seems to be resolved. Thanks @SteveSandersonMS and @android2221 for trying to reproduce this and believing that I'm not crazy 😄 |
Using ASP.NET Core MVC targeting .NET Framework 4.6.2 and Microsoft.AspNetCore.SpaServices v1.1.1, and on the npm side aspnet-webpack 2.0.1, aspnet-webpack-react 3.0.0, webpack 2.7.0, and webpack-hot-middleware 2.18.2. OS is Windows 10, using Chrome 60 and VS2017 15.2, Node 8.2 and 8.3 both affected.
Steps to reproduce:
Multiple teams at my company working on entirely different products with no shared code have encountered this problem. They describe it as happening "sporadically", but I have now diagnosed it down to only happening when multiple tabs are open in your browser to the same localhost site with HMR connected. If you only have one localhost tab open it works great, more than one and it slows to a crawl, timing/erroring out for larger bundles. This appears to be some kind of race condition or deadlock. Confirmed that this happens in Firefox as well, so it appears to be something on the server side.
The text was updated successfully, but these errors were encountered: