Replies: 2 comments 3 replies
-
bro for proper tree-shaking you need to use named export |
Beta Was this translation helpful? Give feedback.
3 replies
-
I have the same issue, and I looking for documentation to find the best way to create a library, no buildable and no publishable, which is tree shakeable using esbuild or bun. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
To start with, here's a minimal repo where you can see the behaviour I'm going to describe: repo
And here's the nx graph of workspace from repo:
My question is how can I perform tree shaking on barrel files from data-access libraries? Running webpack-bundle-analyzer(run
nx analyze host
inside the workspace from provided repo) shows that everything from data-access ends up in initial bundle(or am I misinterpreting the results?). I understand that barrel files from data-access libraries re-export every module the lib has, but I was expecting tree shaking come into action.Output of
nx analyze host
:Both
books-data-access
andusers-data-access
libraries havesideEffects: false
in theirpackage.json
files and I use only a single module from each data-access lib inside host.Beta Was this translation helpful? Give feedback.
All reactions