-
-
Notifications
You must be signed in to change notification settings - Fork 495
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
fix(cli): use module: 'nodenext'
when registering ts-node
#5514
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5514 +/- ##
========================================
Coverage 99.74% 99.74%
========================================
Files 260 260
Lines 17937 17937
Branches 3803 4355 +552
========================================
Hits 17892 17892
Misses 45 45 ☔ View full report in Codecov by Sentry. |
are you sure this doesn't break CJS projects? i think we could maybe remove the overrides completely, as this should be now all taken from the project's tsconfig. maybe we could keep the old behavior when there is no tsconfig found. |
Ok, now I am finally able to reproduce this. You confused me with the |
module: 'nodenext'
when registering ts-node
Awesome! Thanks so much, @B4nan. That will help a lot in a project that I'm working on. We were manually fixing in node_modules so far haha |
This change breaks CLI when using mikro-orm as part of a project that still uses "moduleResolution": "node". Shouldn't a breaking change be part of a major update ? |
It works fine on my end, can you provide a complete repro? I wouldn't do it if I would consider it breaking, I am sure we can make this work conditionally if needed. Btw one way around this is having a separate |
I can't provide a link to the repo where I have the issue, but I tried the following steps (10min to complete a reproduction) and had the same issue :
I did end up finding a solution where I indeed modified the main tsconfig and overwrote the main file in my nestjs and angular apps. But again, this change is breaking, and I shouldn't have to modify config files because I updated to the last minor of mikro-orm. I don't think that I'm familiar enough to help you make this whole thing conditional, but that sure would be great! |
I don't want your repository, I don't care about your app, I want a minimal example that shows the problem.
I never used nx and I am not interested in learning it now.
Without a repro this is just a claim, it works just fine on my end 🤷 So again, please provide a reproduction if you think it's breaking, then we can do something about it. |
Here is a fork of the nestjs-example-app (quickest way to reproduce the problem) : nestjs-example-app_6.2.9. The only change made to the forked repo is adding In 6.2.8, using $ npx mikro-orm debug
Current MikroORM CLI configuration
- dependencies:
- mikro-orm 6.2.8
- node 20.11.0
- knex not-found
- mysql2 not-found
- typescript not-found
- package.json found
- ts-node enabled
- searched config paths:
- /nestjs-example-app_6.2.9/src/mikro-orm.config.ts (found)
- /nestjs-example-app_6.2.9/dist/mikro-orm.config.js (not found)
- /nestjs-example-app_6.2.9/mikro-orm.config.ts (not found)
- /nestjs-example-app_6.2.9/src/mikro-orm.config.js (not found)
- /nestjs-example-app_6.2.9/mikro-orm.config.js (not found)
- configuration found
- database connection failed (connect ECONNREFUSED 127.0.0.1:3307)
- will use `entities` array (contains 5 references and 0 paths) In 6.2.9 : $ npx mikro-orm debug
Current MikroORM CLI configuration
- dependencies:
- mikro-orm 6.2.9
- node 20.11.0
- typescript not-found
- package.json found
- ts-node enabled
- searched config paths:
- /nestjs-example-app_6.2.9/src/mikro-orm.config.ts (found)
- /nestjs-example-app_6.2.9/dist/mikro-orm.config.js (not found)
- /nestjs-example-app_6.2.9/mikro-orm.config.ts (not found)
- /nestjs-example-app_6.2.9/src/mikro-orm.config.js (not found)
- /nestjs-example-app_6.2.9/mikro-orm.config.js (not found)
- configuration not found (⨯ Unable to compile TypeScript:
error TS5109: Option 'moduleResolution' must be set to 'NodeNext' (or left unspecified) when option 'module' is set to 'NodeNext'.
) Hoping this much is good enough ! |
This should help d5d7f38 I really don't understand what happened, it was working just fine and now I can reproduce in the same repo where it worked before. |
Update configuration to allow
mikro-orm-esm
to work with newer versions of tsconfig.#5427