[x] Regression
[ ] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
ts-morph is required in order to use @nestjs/graphql
ts-morph is not required in order to use @nestjs/graphql. Our rather large application was working prior to this release without ts-morph, so not sure what changed.
Attempting to upgrade from 6.5.5 to 6.6.1 raises the following error:
Error: Cannot find module 'ts-morph'
Require stack:
- /app/node_modules/@nestjs/graphql/dist/graphql-ast.explorer.js
- /app/node_modules/@nestjs/graphql/dist/index.js
- /app/node_modules/@nestjs/graphql/index.js
- /app/src/app.resolver.ts
This is a regression as ts-morph was not required prior to 6.6.1 and it is still listed as an optionalDependency
https://github.com/nestjs/graphql/blob/7a135f87784ca47b50028915655fbc00bac2a7cf/package.json#L74
"@nestjs/common": "6.11.8",
"@nestjs/core": "6.11.8",
"@nestjs/graphql": "6.6.1",
For Tooling issues:
- Node version: 12.15.0
- Platform: Mac
- Yarn version: 1.22.0
Others:
search terms: Cannot find module, ts-morph
Just noticed it now as well. (I'm trying to make my nest app work on aws-lambda now, and have been just surprised that it requires typescript and ts-morph dependencies on a production build.)
When looking at dist/graphql-ast.explorer.js source, it relies on that dep in such ways:
const structureKind = mode === 'class' ? ts_morph_1.StructureKind.Class : ts_morph_1.StructureKind.Interface;kind: ts_morph_1.StructureKind.Parameter,So even though we're "trying" to rely on TS typedefs only there in https://github.com/nestjs/graphql/blob/master/lib/graphql-ast.explorer.ts#L102 , it's making the file rely on actual JS variable data coming from ts-morph package.
From briefly analzing the source code of that file, it seems like that the whole code in that class won't be run anyways until explore() is run which then does await import('ts-morph') ?
If so, then maybe we could just move those StructureKind NewLineKind references to be coming from const { StructureKind, NewLineKind } = await import('ts-morph') ?
I can send a quick PR, if maintainers are ok with such solution.
Fixed in 6.6.2. Sorry about this regression!
@kamilmysliwiec with 6.6.2 I still see:
[36mapi_1 |[0m [1m[31mERROR in ../node_modules/graphql/index.mjs 42:0-48:205
[36mapi_1 |[0m Can't reexport the named export 'BREAK' from non EcmaScript module (only default export is available)
[36mapi_1 |[0m @ ../node_modules/@nestjs/graphql/dist/graphql-definitions.factory.js
[36mapi_1 |[0m @ ../node_modules/@nestjs/graphql/dist/index.js
[36mapi_1 |[0m @ ../node_modules/@nestjs/graphql/index.js
[36mapi_1 |[0m @ ./apps/combats/src/app.module.ts
[36mapi_1 |[0m @ ./apps/combats/src/main.ts[39m[22m
[36mapi_1 |[0m
[36mapi_1 |[0m [1m[31mERROR in ../node_modules/graphql/index.mjs 60:0-97:42
[36mapi_1 |[0m Can't reexport the named export 'BreakingChangeType' from non EcmaScript module (only default export is available)
[36mapi_1 |[0m @ ../node_modules/@nestjs/graphql/dist/graphql-definitions.factory.js
[36mapi_1 |[0m @ ../node_modules/@nestjs/graphql/dist/index.js
[36mapi_1 |[0m @ ../node_modules/@nestjs/graphql/index.js
[36mapi_1 |[0m @ ./apps/combats/src/app.module.ts
[36mapi_1 |[0m @ ./apps/combats/src/main.ts[39m[22m
This doesn't seem to be related. Please, create a separate issue and create a repository which reproduces your error.
Most helpful comment
Fixed in 6.6.2. Sorry about this regression!