You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 and users-data-access libraries have sideEffects: false in their package.json files and I use only a single module from each data-access lib inside host.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
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