-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
bundle size worse than preset-env with esmodules:true ? #7
Comments
this sounds like a similar problem to #3. Did you try adding the |
I also don't see any reference to |
Added it: no change to file size. :(
From my original post:
|
I finally got a minute to look at this more closely, and I realized what the problem is: you're using both This will sort itself out once babel/babel#11083 is merged - you'll be able to simply have your |
Ah, thanks, I wasn't aware that babel behaved that way. Thank you for looking into this. |
confirmed to work while using latest babel and |
I was looking into migrating a project that I maintain to preset-modules. However, I've noticed that the resulting bundle size is actually bigger than when I use preset-env with esmodules:true.
I'm not entirely sure that this is the fault of preset-modules, but I can't seem to figure out why it's behaving the way that it is.
To reproduce:
If you clone single-spa, checkout the 5.0 branch,
yarn
install, and then runyarn build:analyze
, here’s the output (which is using preset-env withtargets:{esmodules:true}
- focusing only on theesm
bundle:Then, if you
yarn add -D @babel/preset-modules
, change the.babelrc
file to use@babel/preset-modules
(for the "esm" environment), and then runyarn build:analyze
again, here’s the result:If I do a comparison between the two compiled files, it appears that the size difference comes down to two things: 1)there’s an additional function added:
and 2) all the arrow functions were compiled back to normal
function
s.I'm not sure why either of these things are happening, especially the transpilation of arrow functions to normal functions.
The text was updated successfully, but these errors were encountered: