-
Notifications
You must be signed in to change notification settings - Fork 27k
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
Support "module": "nodenext"
in tsconfig.json
#37525
Comments
Also, |
Are there plans to support it? I'm trying to use a local ES module in my monorepo but it won't resolve without "node16". Even an option to stop Next.js forcibly overwriting the tsconfig.json would be helpful. |
@terenceodonoghue Can you post a Replit repro? |
👋 @ctjlewis, you can try playing with kachkaev/njt#186 where I attempt to switch a small Next.js 13 project to pure ESM with native Node module resolution. I need to use these two workarounds and it’d be great to see them implemented in Next: #41189 (comment). I’m also unable to use Keeping Next.js aligned with native Node module transpiling and resolution helps keep scripts or tests alongside the app. |
Is there some progress on this? |
## ESM: support module option for tsconfig.json - fixes #37525 - fixes #41961 With [TypeScript 4.7 providing ECMAScript Module Support](https://devblogs.microsoft.com/typescript/announcing-typescript-4-7/#ecmascript-module-support-in-node-js), we can now set this in our tsconfig.json file for the [module](https://www.typescriptlang.org/tsconfig#module) option. Webpack added "extensionAlias" to solve importing ts files with .js extension -> webpack/enhanced-resolve#351 Co-authored-by: JJ Kasper <[email protected]>
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Describe the feature you'd like to request
With TypeScript 4.7 providing ECMAScript Module Support, we can now set this in our
tsconfig.json
file for themodule
option:However, Next.js rejects this value, and overwrites it with
"esnext"
.#36189 did add support for
"moduleResolution": "nodenext"
, but not"module": "nodenext"
.Describe the solution you'd like
Add
"nodenext"
and"node16"
tomodule.parsedValues
:I figure there may be other changes necessary to make this work, and that the TypeScript version should be bumped to 4.7+ with it.
Describe alternatives you've considered
I edited
writeConfigurationDefaults.js
directly in mynode_modules
for a local project, and it seemed to work.Relevant aside: I think the discussion at #32237 is a bug that needs to be resolved before this can work as expected. I still haven't been able to import files with the
.js
extension.The text was updated successfully, but these errors were encountered: