-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
New version of webpack creating GraphQL schema conflicts on NestJS app when optimization is true #12208
Comments
+1. I am also experiencing this issue. |
+1 |
Has anyone found a workaround yet? I think I'll just downgrade to |
As a workaround you can use a custom webpack config for your nest projects and disable minimize:
|
I have the same problem in my project but with nestjs and mongoose. Once i build with for prod (
|
same issue, even whit nx serve projecname --prod |
@jaysoo Hi there, I think this is tagged incorrectly as Scope: React. This is NestJS not NextJS. Mine was user error. I had a shared library that had @ObjectType in it 😄 |
I think we will probably need to change Its documentation is not ready yet: https://nx.dev/packages/webpack |
This is so annoying. I don't really wanna touch the config file(workaround) in the middle of the first deployment of my app. I believe the Nx team should take care of this issue. |
Any updates on this issue? I have tried the default configuration when creating a new app, using "build": {
"executor": "@nrwl/webpack:webpack", // <- it was originally @nrwl/node:webpack
"outputs": ["{options.outputPath}"],
"options": {
"target": "node",
"compiler": "tsc",
"outputPath": "dist/packages/backend",
"main": "<path-to-main>",
"tsConfig": "<path-to-tsconfig>",
"assets": ["<path-to-assets>"],
"generatePackageJson": true
},
"configurations": {
"production": {
"optimization": true,
"extractLicenses": true,
"inspect": false
}
}
}, Currently tested with all |
changing "optimization" to false work for me |
Same for me, but it’s not a long term solution as it does not minify the production release. |
Changing optimisation to |
Small update: Still happening on latest version |
Whats up @nartc ? |
I think it is working fine on versions |
I finally migrated to 15.5.1 and it did not cause an error - It is alot slower tho. Makes me want to try something other than webpack like vite or swc with nestjs. |
We are doing some work around Node server frameworks, and the recommended default is esbuild (using If you are using webpack, you can try |
This PR makes it so by default, Node apps do not optimize through Terser (which is slower): #14431. You can pass |
Closing this issue as it is fixed. |
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
Migrating
@nrwl/node
from version"14.7.5"
to"14.7.10"
or"14.7.11"
creates a name collision when building a@nestjs/graphql
app in production mode ("optimization": true
).Expected Behavior
Updating
@nrwl/node
from version"14.7.5"
to version"14.7.11"
should still build the NestJS app as previously.Steps to Reproduce
Minimal example repo: nx-webpack-bug
Install all dependencies and run
yarn nx serve backend --prod
.It will fail with a message:
Error: Schema must contain uniquely named types but contains multiple types named "l".
Change the version of
@nrwl/node
to"14.7.5"
, then change the build executor of theapps/backend/project.json
file from@nrwl/webpack:webpack
to@nrwl/node:webpack
. Runningyarn nx serve backend --prod
will succeed.When optimization is true, some GraphQL names end up having the same name, and so the process fails. This was most likely introduced with the latest changes of moving the webpack plugin.
I have gotten far in creating a minimally reproducible example, so I feel close to the issue. If I get some minimal direction I would love to dig deeper and provide a PR to solve it. <3
Failure Logs
Environment
The text was updated successfully, but these errors were encountered: