-
-
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
export * from './some-file'
in library breaks tree-shaking ability
#8216
Comments
Investigated a little but can't spend more time on it right now. The re-exported asset has its |
This is also affecting us. I've recently migrated over to Parcel from Webpack, and noticed our bundle sizes were double the size because of this exact issue. |
works around parcel issue: parcel-bundler/parcel#8216
Is someone working on this? Is there a workaround? I am experiencing the same issue |
π bug report
It seems Parcel2 breaks tree-shaking ability when
export * from β¦
is used.This used to work for us with Parcel1, all we've done is upgraded to Parcel2.
π Configuration (.babelrc, package.json, cli command)
No special config, all stock straight out of parcel2
π€ Expected Behavior
I would expect that using
export * from
, the exports would still be statically analysable because all these types of exports in ESM are static.π― Current Behavior
It breaks tree-shaking and all the members of the modules are included, even unused ones.
π Possible Solution
I wonder if it's because Parcel now operates at the string level, rather than AST, and therefore it cannot "see" what's exported from the file when we do
export * from β¦
.π¦ Context
This has broken tree-shaking in https://github.com/radix-ui/primitives since we moved to parcel2.
π» Code Sample
I've narrowed this down to its most basic form and made a video of it.
Don't forget to turn the sound π on as I explain the situation:
CleanShot.2022-06-15.at.14.22.40-converted.2.mp4
To summarize, if top-level library file is:
Then the module output for it looks like this:
however
If the top-level library file is:
Then the module output for it looks like this:
π Your Environment
The text was updated successfully, but these errors were encountered: