-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Tree shaking not working #6522
Comments
I also tried it with React, as the aliasing might give issues. This gives the same behavior, with an even larger bundle size.
You can view this version on the |
This seems to be related to #4565. |
First problem: it builds but doesn't run. There's an undefined object error at runtime. This is related to #6361 and chakra-ui/chakra-ui#4289 but we should do a better job surfacing the error at build time potentially, or fix symbol propagation so it ignores empty exports. cc. @mischnic After commenting out As for the actual bundle size, a few problems:
You should bring these issues with the Chakra UI team / the framer motion team. Perhaps they can improve the design of their libraries to be more tree-shakeable. I don't think there's anything Parcel can really do here. Our bundle size output seems to be mostly in line with webpack or even smaller. |
Weird, it compiles fine for me. The gzipped vs non-gzipped difference is a mistake on my end, with that in mind the size seems within expectation for the library. I'll close it for now, as this is an non-issue for Parcel then. |
🐛 bug report
Three shaking does not seem to be working. After adding Chakra UI to my bundle the size increased from 8 kb to 262 kb. Looking at the reporter it does not seem like the tree shaker is working. Talking to other people using different bundlers, the bundle should be at least 60% smaller.
🎛 Configuration (.babelrc, package.json, cli command)
See the code sample.
🤔 Expected Behavior
I expect the bundle to be much smaller.
😯 Current Behavior
No errors, just a large bundle. It currently looks like:
And without Chakra:
Even with CRA (using the larger React instead of Preact), it's more than half the size:
💁 Possible Solution
Not sure.
🔦 Context
I'm just trying to use Chakra without increasing the bundle that much.
💻 Code Sample
Minimalistic repository can be found here. After installing the dependencies you can run
yarn analyse
to generate the report.🌍 Your Environment
The text was updated successfully, but these errors were encountered: