-
-
Notifications
You must be signed in to change notification settings - Fork 75
If tsconfig.json
is set to CommonJS mode, the declaration files cannot be read.
#1303
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
Comments
Hi @yuheiy, This is not a bug, this is by design. The types we do have for es modules are only valid for the es modules source, not for the commonjs source. See #1031 (comment) for more context. |
Thank you for checking out some tools @yuheiy, At first glance I tried At this time I've kinda embraced this issue. Typings are a secondary feature and es modules is the future. So from our perspective it makes more sense to focus on providing the best dev experience for es modules while also having a correct runtime for commonjs. |
Thank you for your explanation. Now that I understand what the problem is, I will close the issue. |
Just so you know, I initially aimed to create a CommonJS (only) package using your module with tsc, specifically a PostCSS plugin. Given the issue, I've now decided to go with a bundler instead. |
Reproduction link
No response
Bug description
If
tsconfig.json
is set to CommonJS mode, the declaration files for almost modules cannot be read.tsconfig.json
:test.ts
:The cause is probably that the
types
is not set inpackage.json
."main": "dist/index.cjs", "module": "dist/index.mjs", + "types": "dist/index.d.ts", "exports": { ".": { "import": { "types": "./dist/index.d.ts", "default": "./dist/index.mjs" }, "require": { "default": "./dist/index.cjs" } } },
Actual Behavior
No response
Expected Behavior
No response
Can you reproduce it with
npx @csstools/csstools-cli <plugin-name> minimal-example.css
?None
npx
OutputNo response
Extra config
No response
What plugin are you experiencing this issue on?
No response
Plugin version
What OS are you experiencing this on?
No response
Node Version
20
Validations
Would you like to open a PR for this bug?
The text was updated successfully, but these errors were encountered: