-
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
Reload/refresh not working in v18 and v17 #22945
Comments
Seems like its not only an issue related to NestJS. I've also tried it with an express app and a few different executors, but none of them worked for an express or nest app. The only executor which works for me is next, but I obviously can't use that for a nest app. |
Downgrading to v17 didn't work either. |
I also experienced this issue. |
Got the same issue. Please fix ASAP. I can't/won't use NX any further if this major issue is not being fixed. |
I have experienced this with both Nest and Remix, on both windows and Mac. |
I agree. Manually having to restart every process for each file change is so painful. I hope this gets fixed soon. |
I can't reproduce this on Windows or Mac with Nx 19. Can you retry with Nx 19? |
I just upgraded to v19, but the same error still exists. I'm on linux but as @Evanion mentioned, the issue seems to also exist windows and mac. |
After spending hours debugging nx in my node_modules folders, I've identified the root cause of the issue! 🥳 The conflict arises when using nx alongside Vim, though it might also affect other editors. Here’s a brief explanation: Vim employs a delete-and-recreate method when saving files. This process involves deleting the file momentarily before writing a new one. This behavior triggers the nx native file watcher (within the daemon) to emit a For Vim users, a potential workaround is to use While I haven't tested it myself, ChatGPT suggests that other editors like IntelliJ, Eclipse, or Emacs may use a similar technique. Editors like Sublime offer this option, but it is not enabled by default. I will keep this issue open as I believe an adjustment in nx’s file watcher could inherently support editors like Vim without requiring manual configuration changes. |
Personally, I'm exclusively on VSC. And I still gt this issue. |
@Evanion I read there is a similar setting in vscode, which is not enabled by default. Maybe you could try clearing the cache, restarting the command and then saving the file with another editor? |
This issue has been automatically marked as stale because no results of retrying on the latest version of Nx was provided within 7 days. |
Is there any update to this issue. Still persists (NX 18.2.4 and Nestjs). In the same repo live reload of angular works just fine. |
@St1c What editor are you using? |
This issue has been automatically marked as stale because no results of retrying on the latest version of Nx was provided within 7 days. |
The same problem exists with the latest version of Nx. |
Related: #21734 |
Still having this issue with Switching to |
For me it was fixed by switching from the basic webpack configuration to the nx-enhanced configuration (https://nx.dev/recipes/webpack/webpack-config-setup#nxenhanced-configuration-with-composable-plugins). |
use nxenhanced configuration works {
"name": "<project-name>",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/<project-name>/src",
"projectType": "application",
"tags": [],
"targets": {
"build": {
"executor": "@nx/webpack:webpack",
"options": {
"webpackConfig": "apps/<project-name>/webpack.config.js",
"main": "apps/<project-name>/src/main.ts",
"tsConfig": "apps/<project-name>/tsconfig.app.json",
"optimization": false,
"outputHashing": "none",
"sourceMap": true,
"outputPath": "dist/apps/<project-name>/",
"compiler": "tsc",
"target": "node"
}
},
"serve": {
"executor": "@nx/js:node",
"defaultConfiguration": "development",
"options": {
"buildTarget": "<project-name>:build"
},
"configurations": {
"development": {
"buildTarget": "<project-name>:build:development"
},
"production": {
"buildTarget": "<project-name>:build:production"
}
},
"dependsOn": [
{
"projects": [
],
"target": "build"
}
]
}
}
}
and webpack.config.js const { composePlugins, withNx } = require('@nx/webpack');
module.exports = composePlugins(
// Default Nx composable plugin
withNx(),
// Custom composable plugin
(config, { options, context }) => {
// `config` is the Webpack configuration object
// `options` is the options passed to the `@nx/webpack:webpack` executor
// `context` is the context passed to the `@nx/webpack:webpack` executor
// customize configuration here
return config;
}
); |
Current Behavior
When I serve my NestJS project in development and change a file, it reloads perfectly the first time. When I change the file again, it stop refreshing and does nothing. This also happens in a fresh project with
npx create-nx-workspace my-workspace --preset=nest
Expected Behavior
It should refesh every time I change a file, not only the first time.
GitHub Repo
No response
Steps to Reproduce
npx create-nx-workspace my-workspace --preset=nest
nx serve api
Nx Report
Failure Logs
Package Manager Version
pnpm@8.15.2
Operating System
Additional Information
No response
The text was updated successfully, but these errors were encountered: