After upgrading from NX 10.0.13 to 10.1.0 When serving my Nest app in development mode it successfully compiles then starts compiling in an infinite loop. The serving an Angular is working correctly, this is specific to a node Nest app.
Note that it works if I revert the @nrwl/node dependency from 10.1.0 to 10.0.13 but leave all other nrwl dependencies alone, so it's a regression specifically with @nrwl/node 10.1.0.
nx serve should only recompile when file in project changes and shouldn't infinite loop.
I was not able to reproduce on a newly created NX Nest app but I did go through all the changes in @nrwl/node 10.1.0 and didn't see anything that stood out to me https://github.com/nrwl/nx/commits/master/packages/node
There is no failures, just infinite loop, do you have any recommendations on how to log the issue?
Working:
nx : Not Found
@nrwl/angular : 10.1.0
@nrwl/cli : 10.1.0
@nrwl/cypress : 10.1.0
@nrwl/eslint-plugin-nx : 10.1.0
@nrwl/express : 10.1.0
@nrwl/jest : 10.1.0
@nrwl/linter : 10.1.0
@nrwl/nest : 10.1.0
@nrwl/next : Not Found
@nrwl/node : 10.0.13
@nrwl/react : Not Found
@nrwl/schematics : Not Found
@nrwl/tao : 10.0.13
@nrwl/web : Not Found
@nrwl/workspace : 10.1.0
typescript : 3.9.7
Not Working:
nx : Not Found
@nrwl/angular : 10.1.0
@nrwl/cli : 10.1.0
@nrwl/cypress : 10.1.0
@nrwl/eslint-plugin-nx : 10.1.0
@nrwl/express : 10.1.0
@nrwl/jest : 10.1.0
@nrwl/linter : 10.1.0
@nrwl/nest : 10.1.0
@nrwl/next : Not Found
@nrwl/node : 10.1.0
@nrwl/react : Not Found
@nrwl/schematics : Not Found
@nrwl/tao : 10.0.13
@nrwl/web : Not Found
@nrwl/workspace : 10.1.0
typescript : 3.9.7
Thank you for the help!
I came across the same error/scenario. I wonder if this is a file path globbing issue?
(maybe related to this commit https://github.com/nrwl/nx/commit/5a59f090fe4dc38a9c5ecce69e5c8d2a6b3f6bb4#diff-9c963a31a1b9f6c1174cb8b934dfceb9)
@thiessenp just to double check, is the issue fixed for you by downgrading @nrwl/node to 10.0.13?
@arjunyel yup, if I rollback to an earlier version the issue goes away
Unrelated info I think but just encase: the error for me happens in projects that have custom typescript linting rules (two different node API's). The generic/default config works fine (angular client). This is why I have a suspicion about the file path globbing rules but I don't really have anything to back that up.
Found the problem in our project's case. We had the following in the workspace.json build config for the app:
"assets": [
"apps/appName/src/assets",
{
"glob": "package*.json",
"input": ".",
"output": "./"
}
]
Removing the package*.json stopped the infinite restart loop. I think the reason it was in there is because a developer had wanted package.json and package-lock.json in the app's dist folder so they could run npm install directly from the dist.
Wow awesome job tracking this down! I can confirm I also have that exact entry in my assets for my nestjs server
{
"glob": "./package*.json",
"input": ".",
"output": "/"
}
However I need to put the package.json in there because I then put the dist folder into a docker container. I'll update the issue title
So, I spoke too soon - we also need the package files to build a docker image down the line. That's what I get for taking summer vacation and forgetting all the things 馃槃
Anyway, removing the * glob and explicitly listing both files also fixed the restart loop on my end. Hopefully it'll work for you too @arjunyel:
```javascript
{
"glob": "package.json",
"input": "./",
"output": "./"
},
{
"glob": "package-lock.json",
"input": "./",
"output": "./"
},
This seems to be a problem of copy-webpack-plugin on watch mode, and the thing that is related to 10.1.0 is that we upgraded it to v6. One solution is to either wait for copy-webpack-plugin to solve this or flatten the files on our side before passing them to it, but this has the problem of not watching for new files that could match the glob 馃槙
Most helpful comment
Found the problem in our project's case. We had the following in the workspace.json
buildconfig for the app:Removing the
package*.jsonstopped the infinite restart loop. I think the reason it was in there is because a developer had wanted package.json and package-lock.json in the app's dist folder so they could runnpm installdirectly from the dist.