Reputation: 5226
So let's assume I have an NX monorepo with 2 apps: Angular and Nest. Since it is a monorepo it has a common package.json file with dependencies, both for client and server. The question is simple: will my Angular's bundle contain Nest dependencies and vice versa? In other words, is there is some kind of treeshaking so the unused code is removed from the final bundle?
Upvotes: 2
Views: 1011
Reputation: 70470
If you use the built in ng
functionality, that all deals with webpacking and tree-shaking your code, so it will not cross your angular dependencies with your Nest ones, unless they are needed. This works with ng build
and espeically with the --prod
flag.
Note: webpacking the server is a little weird, as it does mean your entire server runs from one file, which is a bit different in the node world, but it is still doable.
Upvotes: 2