-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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 tsconfig/json
moduleResolution
to bundler
#9007
Comments
Agree! But in case you really need this today make use of {
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./component": {
"types": "./dist/component.d.ts",
"default": "./dist/component.js"
}
},
"types": "./dist/index.d.ts",
"typesVersions": {
"*": {
"component": [
"dist/component.d.ts"
]
}
}
} |
With |
We won't be changing
Instead we should leverage TypeScript 5.0's upcoming Changing this is a breaking change though (at least for |
tsconfig/json
moduleResolution
to node16
or nodenext
tsconfig/json
moduleResolution
to bundler
if you don't want to use
|
Describe the problem
To reiterate this issue: In TypeScript 4.7, along the property "module": "node16" that enables ESM features in TypeScript, there are new values for the property "moduleResolution": "node16" and "nodenext". Both values allows importing from dependencies with package.json exports, imports, and self-referencing.
Right now, this property in the default
.sveltekit/tsconfig.json
is "node." This doesn't support features like defining "types" in "exports".Describe the proposed solution
Change
tsconfig/json
moduleResolution
tonode16
ornodenext
. This will mean that relative import paths need explicit file extensions - so'./$types.js';
instead of'./$types';
, and similar changes. It'd be a breaking change, atleast for typescript linting, but seems to be more future proof.Alternatives considered
Keep
moduleResolution
asnode
. It's less future proof, as we'll keep having to usedeclare module
and a globaltypes
property inpackage.json
.Importance
nice to have
Additional Information
No response
The text was updated successfully, but these errors were encountered: