Heads up: Breaks under typescript 4.7 RC's module: node16 #991
simonbuchan
started this conversation in
General
Replies: 2 comments
-
|
Here's the relevant announcement post section: https://devblogs.microsoft.com/typescript/announcing-typescript-4-7-rc/#esm-nodejs |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Need to bump this. Adding "types" to "package.json" somehow allows |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

Uh oh!
There was an error while loading. Please reload this page.
-
Thought I would mention this as a discussion first, instead of an issue, as this might be better as typescript feedback, rather than (or in addition to) a fix here, so I wanted to get a feel for what's up here first, especially as solid has some interesting interactions here (e.g. SSR import conditions).
Essentially the issue is that Typescript 4.7 adds the
"module": "node16"option, which aims to match the node-native ESM support. As part of this, it now also implements theexportspackage field, and uses that in preference to the top-levelmain, and particular to this issue, it uses a newtypesimport condition instead of the top leveltypes, not only if there is atypescondition present, but if there is anexportsfield present at all (e.g. it errors or uses thedefaultcondition, replacing the extension with.d.ts, AFAICT?)The issue here is that since solid, like many existing packages out there, uses a separate
typesoutput dir, typescript resolves paths likesolid-js/webtosolid-js/web/dist/server.js, and doesn't find a sibling.d.ts:Example config, errors
You can also see that typescript will by default find the
nodecondition, serving the../dist/server.jsrather than the seemingly intended../dist/dev.js- that seems like a problem too, as you don't have a way to override the import conditions typescript uses.Beta Was this translation helpful? Give feedback.
All reactions