Open mb21 opened 7 months ago
Thank you for looking into this!
I'm not an expert in babel and npm package bundling, but AFAIK it's nowadays best practice for a JS library to kinda just ship the source, so that the bundler in the project that consumes the library can optimize for the browsers they want to support and tree-shake away the functions not used?
I agree, we should get rid of the polyfill for async/await and generators. We can assume support for those features in the tooling by now.
Looking at the bundle files for
lib.esm
for example:(this was generated in an Astro.js project with
rollup-plugin-visualizer
).I was especially curious why
lib.esm/browser/fileReader.js
is so big even though the source file is only a few lines. Runningyarn run build-transpile-esm
results in a 14kb file. The problem is that babel includes all the following functions:Most of which is not needed for more or less modern browsers anymore.
I'm not an expert in babel and npm package bundling, but AFAIK it's nowadays best practice for a JS library to kinda just ship the source, so that the bundler in the project that consumes the library can optimize for the browsers they want to support and tree-shake away the functions not used?