Skip to content
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

Consider switching to ESM only build/artifacts #1778

Closed
bd82 opened this issue Mar 6, 2022 · 3 comments
Closed

Consider switching to ESM only build/artifacts #1778

bd82 opened this issue Mar 6, 2022 · 3 comments

Comments

@bd82
Copy link
Member

bd82 commented Mar 6, 2022

Why

Reduce maintenance overhead of supporting multiple consumption options, currently:

  1. commonjs
  2. UMD bundle
  3. UMD minified bundle
  4. ESM wrapper
  5. ESM bundle
  6. ESM minified bundle

For example Chevrotain currently uses two bundling tools, both esbuild and webpack

When

Likely still too early to do so, need to give the JS / Node community time to adjust.
Some popular packages have started doing so already, we should keep track of their progress and/or success in doing so.

How

  • Compile to ESM with TypeScript
  • Major version with breaking changes
  • Remove webpack, and attempt to use onlyesbuild
  • Remove minified UMD packages
  • Update playground / benchmarks to use ESM resources.
  • Update docs to clearly indicate the package is ESM only.
@bd82
Copy link
Member Author

bd82 commented Jun 20, 2022

I think this should be evaluated at April 2023 once nodejs 16 is deprecated
and all LTS nodejs versions will support ESM.

@bd82
Copy link
Member Author

bd82 commented Jul 5, 2023

Switching to lodash-es and compiling typescript to ESM instead of commonjs seems to reduce the minified bundle size
by ~20% (40Kb).

@bd82
Copy link
Member Author

bd82 commented Jul 8, 2023

Done in: #1953

I'm still keeping the UMD artifacts (chevrotain.js / chevrotain.min.js) for browser usage.
But from nodejs only ESM is supported.

@bd82 bd82 closed this as completed Jul 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant