-
Notifications
You must be signed in to change notification settings - Fork 861
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: ECMAScript Modules in Node.js #2130
Conversation
I hope you can review and merge it soon. keep bringing us your grate UI library. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
@benoitgrelard , @andy-hook |
9d592bf
to
f575043
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing this @onemen, it all looks good I think.
I'll ping you back here once the RCs have been generated, it would be great if you could then test out locally using the RC to confirm that it all works as you expect with ESM. 🙏
OK, Thank you |
Ok, they have been generated, you can see all the versions here: Let me know if it all works as you expected locally when using ESM. |
just tested
on this project https://github.com/epicweb-dev/rocket-rental everything work ok we have to use a workaround and import from - import Checkbox from '@radix-ui/react-checkbox/dist/index.js'
- import DropdownMenu from '@radix-ui/react-dropdown-menu/dist/index.js'
+ import * as Checkbox from '@radix-ui/react-checkbox'
+ import * as DropdownMenu from '@radix-ui/react-dropdown-menu' |
Great! Glad it all works correctly. And thanks again for the contribution! 🙏 |
Update all primitives to support ECMAScript Modules, resolve #1848.
typescript: ECMAScript Modules in Node
node: exports
index.d.ts
toindex.d.mts
, see the code inscripts/fix-type-defs-imports.js
this is the relevant quote from typescript:
It’s important to note that the CommonJS entrypoint and the ES module entrypoint each needs its own declaration file, even if the contents are the same between them
this is the relevant section from
package.json