Skip to content
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

Change Node 16 moduleResolution to "Node16" #121

Closed
luis815 opened this issue Jul 19, 2022 · 7 comments
Closed

Change Node 16 moduleResolution to "Node16" #121

luis815 opened this issue Jul 19, 2022 · 7 comments

Comments

@luis815
Copy link

luis815 commented Jul 19, 2022

Issue

Current moduleResolution value is "node". This doesn't seem to support "exports" in package.json.

Possible Solution

Change moduleResolution to "Node16" seems appropriate. A quick test overriding the value after extending this configuration seems to solve the issue.

@orta
Copy link
Member

orta commented Jul 19, 2022

It is a good question of when people might expect esm projects to be the default, but I'm not quite sure that is right now.

I'm open to having a separate node16+esm (we already have a node16+strictest+esm for example) but I don't think changing the default is a good call for maybe a few years

@voxpelli
Copy link

+1 on a node16+esm if the main one can't have it

@orta
Copy link
Member

orta commented Jul 20, 2022

Sure thing, add it

@Gerrit0
Copy link

Gerrit0 commented Aug 10, 2022

when people might expect esm projects to be the default

If module is set to commonjs, moduleResolution can be set to node16 to allow import/export maps to work properly while still emitting cjs

@Gerrit0
Copy link

Gerrit0 commented Aug 10, 2022

Actually, that seems to not even be required.

https://www.typescriptlang.org/tsconfig#module

I'm using node16 in the beta branch for TypeDoc and am getting cjs output as expected.

@bradennapier
Copy link

bradennapier commented Jul 3, 2023

In typescript 5.2 it is an error to have moduleResolution set to node so we will need a separate esm vs cjs option.

Currently with 5.2 the node18 base config does not work. It requires you add Node16 as moduleResolution which will force esm support which makes it impossible to use with our project.

Looks like module will need to change

https://devblogs.microsoft.com/typescript/announcing-typescript-5-2-beta/#module-and-moduleresolution-must-match-under-recent-node-js-settings

microsoft/TypeScript#54620

@orta
Copy link
Member

orta commented Jul 4, 2023

This happened in #197

@orta orta closed this as completed Jul 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants