-
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
Package data for NPM as ESM and CJS #12169
Conversation
Previously only a CJS entrypoint was provided. This provides a ESM entrypoint that can be directly used from Deno or a browser.
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.
Thank you for splitting this out, I'm super excited for this! 😄 I have just a small suggestion and a question, but from a quick skim of the code this is looking good to me overall!
Okay, so I had a feeling this might be a breaking change, and it looks like my suspicions were correct. BCD's exported packages don't expose the version number, so I require the included |
Import assertions are now widely available in server side runtimes. Chrome supports them, and so do both Deno (since 1.17) and Node (since v17). As such we could now keep the JSON in a seperate file for publishing again, and then re-export it from the ESM module using import assertions. @queengooborg We could do the same with the version from package.json. |
Actually - scrap that. Node 17 does not support JSON modules without the I guess the current thing here is the best thing we could do for now. |
Node unflagged import assertions in v17.5.0 (released 2022-02-10). Probably too soon to rely on them? |
Yeah, I'd say it's too soon, especially since our developer requirement is NodeJS v14. Thanks for double-checking! |
Makes sense. Once the requirement is NodeJS v18, this is the patch to apply to clean up:
|
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.
I went ahead and updated the readme to include an ESM import example, but all in all this is looking great to me! Thank you so much for this, I'm super excited to see this in the next release!
This reverts commit b740c60. This change is semver major and I'm not prepared to do that this week.
Previously only a CJS entrypoint was provided. This provides a ESM
entrypoint that can be directly used from Deno or a browser.