Replies: 1 comment 3 replies
-
bro for proper tree-shaking you need to use named export |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
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