-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
fix: default package exports #15869
fix: default package exports #15869
Conversation
We should add |
We should add |
Looks like Downloaded tgz file from npm registry: https://registry.npmjs.org/@tailwindcss/node/-/node-4.0.0.tgz |
@userquin Hey! I wonder if you're still working at this since the PR is open. @thecrypticace and me have been thinking about this problem as well and our most recent thinking is that we may need to hand-write all exported types. :/ |
@philipp-spiess I'm not working on the PR since the problem is about changing all the packages, you can remove the cjs types fix once next I suggest you to add/use arethetypeswrong cli (attw) here; for example, check this PR at VueUse vueuse/vueuse#4648 |
This PR includes the following changes to the
packages/tailwindcss
package (check Context):plugin.ts
module, cannot be used with Typescript 5.7"type": "commonjs"
to package.json./lib/util/flattenColorPalette.js
variant to package.json exports (publishConfig
)Context
The current version at npm registry has all types broken for all packages exports. The problem seems to be with tsup since it is not applying the
.cts
hack, alld.ts
files usingexport { X as default };
, check https://arethetypeswrong.github.io/?p=tailwindcss%404.0.0 .With this PR (for context check this PR unjs/unbuild#475 and this md file https://github.com/unjs/unbuild/blob/a011a7831e2004688bf44716f5e9c9377d08ebec/src/builders/rollup/plugins/cjs.md):
This PR includes a new script module that runs after tsup finish building the dist, extracting the default export and applying some replacements in the files including the default
export
correclty:export = X;
and remaining named exports in the default export statement.About exporting the types in the
plugin.ts
module, when using TypeScript 5.7 there is an error. Using the following code with any module resolutionand building it via
tsc -b
, there is an error about required annotation:Using a local tgz from this PR, TypeScript is fine when building the module:
You can generate the local tgz using this PR in the following repository (use packages/plugin): https://github.com/iconify/iconify-tailwind