-
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
Publish ESM-ready bundles of BCD #15916
Comments
Thanks for filing this and soliciting feedback.
This size increase is substantial, especially for a fundamental/deeply integrated package like BCD. Is it possible to publish two separate packages called |
Thank you for your feedback, this is exactly what I was looking for! Ruth (@Rumyra) and I discussed this a little bit in a one-on-one, and releasing separate versions was one of the possibilities we had discussed. If at all possible though, I would love to provide some way that the raw JSON can still be accessible, such as for consumers using other languages (Python, C++, etc. -- especially as I'm one of such consumers), which has been a challenge considering that import assertions was only just released isn't available to all of the LTS NodeJS versions (at least, not yet). If it was, that'd solve all of the problems right there. |
@antross @Fyrd @schalkneethling Do you guys have any feedback on this? |
It looks like import assertions are available in NodeJS v16.15.0 and v17.5.0 (https://nodejs.org/api/esm.html#import-assertions), so I think it's safe for us to take advantage of it, perhaps? It would mean that we wouldn't support NodeJS v14 which is in LTS for the next year, though... |
@caugner is also working on getting Yari updated to ESM, so perhaps he will have some feedback here. Personally, I am just happy to see this work happening. Thanks, @queengooborg! |
I figured out a solution that would allow for ESM imports on all NodeJS LTS versions without compromising on package size, which has been integrated into #16232! Basically, my solution is the following:
This way, all the data will remain in a single file, |
As the NodeJS realm transitions to ECMAScript Modules, we have been looking to do the same. We currently have a pull request open, #15775, that introduces ESM-compatible builds to the published version of browser-compat-data. We are not planning to break compatibility with existing setups -- that is, we will still maintain CommonJS support for existing consumers, whilst attempting to maintain compatibility across as many NodeJS versions as possible. Because of this, there will be one drawback:
ESM cannot import JSON, and so to ensure compatibility across NodeJS, Deno and browsers, we must double the size of the package.
We realize that this may put an additional burden upon our consumers, especially those with strict file size limitations. Before we proceed with this change, we would like to obtain feedback from our consumers.
The text was updated successfully, but these errors were encountered: