-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HMR super slow with React project since 15.6.0 #14580
Comments
Hi bdebon, do you, by any chance, extend the webpack configuration, in any fashion? I have noticed the same behavior. Here's the ticket where I've reported it at #13125 |
Hello @nemonemi, I'm affraid wa have not touched anything about webpack configuration. The only
|
Have the same issue. The webpack config is the default one. |
@bdebon, in the example repo, that I've added to my ticket I've showcased how a simple custom Webpack extension breaks the HMR. import { merge } from 'webpack-merge';
module.exports = (config: any) => {
console.log(config); // I have noticed that HMR comes configured properly as "hot: true", but the HMR, after the merge, doesn't work
return merge(config, {
module: {
rules: [
{
test: /\.pdf$/i,
use: ['file-loader'],
},
],
},
});
}; As far as I've observed, the output of the |
Yes I saw that, and I understand that it could be an interesting lead, but I have not touched anything webpack related in my project... Let's see if other people get the same issue after migrating, for now, I postponed a little bit our migration. |
I think I maybe figured what is the root cause when I noticed my ReactQuery DevTools not showing up: The process.env.NODE_ENV is undefined, which leads to HMR being disabled as it is running in production mode. Edit: there is already an issue about this #14547 |
Thanks for the hint. I was able to manually set the package.json {
"scripts": {
"start": "cross-env NODE_ENV=development nx serve our-app"
...
}
} |
@JackMorrissey No problem, glad you found a workaround 👍 |
After updating from 15.4.2 to 15.6.2 I can confirm the exact behavior of not having the NODE_ENV set. Also, for me, this version either changes nothing, since with the extended webpack config, the full-page-reload occurs, instead of HMR. |
Still present as of 15.6.3 |
We are experiencing this issue too in 15.6.3 Workaround, add in workspace root |
@nemonemi - I had this same issue, but setting Side note for anyone that cares, I only have a custom webpack conf to add fallbacks for nodejs core modules since 15.4.6 also removed the polyfills that had been included. I get that that makes it consistent with what webpack 5 does, but it was a breaking change included in a patch version release. |
This doesn't work for me. Every time I try to add For context, I'm using the following config in "build": {
"executor": "@nrwl/webpack:webpack",
"options": {
"outputPath": "dist/apps/app",
"index": "apps/app/src/index.html",
"main": "apps/app/src/main.tsx",
"polyfills": "apps/app/src/polyfills.ts",
"tsConfig": "apps/app/tsconfig.app.json",
"assets": ["apps/app/src/favicon.ico", "apps/app/src/assets"],
"styles": [],
"scripts": [],
"webpackConfig": "apps/app/webpack.config.js",
"skipNxCache": true
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "apps/app/src/environments/environment.ts",
"with": "apps/app/src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
}
]
}
},
"outputs": ["{options.outputPath}"]
},
"serve": {
"executor": "@nrwl/webpack:dev-server",
"options": {
"buildTarget": "app:build"
},
"configurations": {
"production": {
"buildTarget": "app:build:production"
},
"development": {
"buildTarget": "app:build:development"
}
},
"defaultConfiguration": "development"
}, |
@bdebon , the suggestion from @bheftel and @jaysoo from my ticket resolved the HMR to start working again, and not to have a hard reload of the screen. However, as your title says, it is still very slow. It takes around 15 sec for HMR to apply changes. p.s. I am experiencing this on the v15.4.2. Node : 16.14.0 nx : 15.4.2 |
I'll look into it. The problem could be the wrong env being set in the executor. |
We'll patch it for 15.6 and it'll be in the next 15.7 release as well. |
Thank you so much, guys! I finally made migration this morning, and it worked like a charm! HMR is back and as fast as it used to be! |
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context. |
Current Behavior
Up until our last migration to 15.6.0 (we were in 15.5.1), adding a
console.log
somewhere in the code was compiling in less than a second and was added to our browser project without any refresh.Since the update to
15.6.0
the compilation takes something like 8s and force a refresh of our browser page.Expected Behavior
We would like the compilation to take the same time that before the migration and that the page is not "forced-refresh".
Github Repo
https://github.com/Qovery/console
Steps to Reproduce
rm -rf node_modules yarn.lock && yarn
console.log
anywhere and see how long the terminal takes to compileNx Report
Failure Logs
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: