It depends on your use case.
The advantage of not having a separate vendor chunk is that you'll be able to get a smaller bundle size. How much smaller depends on your app. I suggest trying a build with and without the flag to see if there is a significant difference.
On the other hand, the main advantage of having vendorChunk enabled is that the users will be able to only download the changed client code without the third party code(Which are less likely to be changed often).
In summary:
Set vendorChunk to true if:
- You plan on updating the client code often without changing much of the third party libraries.
Set vendorChunk to false if:
- There is a significant bundle size reduction by doing so OR You are unlikely to change client code frequently
{
//...
"architect": {
"build": {
//...
"configuration": {
"production": {
"vendorChunk": true,
"commonChunk": true,
}
}
}
}
//...
}
Vendor Chunk
- 3rd party code usually node_modules
- Useful if you are not making changes to third party code or node_modules
- Only changing business logic
Async
- Separate files for code which can be lazy-loaded
- Happens automatically with lazy route or manually with dynamic import;
import()
Common Chunk
- Code shared between different chunks