2

So I have a lazyloaded module called "ProductModule", which is responsible of my product page.

export const routes: Routes = [{
    matcher: productMatcher,
    loadChildren: './+product/product.module#ProductModule',
}]

In this module, we use a npm package for showing a gallery of picture (and a bunch of others). When analysing the build, I saw that all these packages was bundled into "vendor.js" chunk.

As long as they are only used and imported in ProductModule, do you know a way to bundle this lib in the same chunk as ProductModule ?

Thanks.

dolig
  • 134
  • 9
  • 3
    That is the disadvantage of using a vendor chunk. It might be better to not use it if lazy modules contain a lot of third-party dependencies. You can try what happens by setting "vendorChunk": false in angular.json? – MikeOne May 27 '20 at 14:39
  • 1
    Oh, this is a very good idea. Will try. Thanks. – dolig May 27 '20 at 14:46

0 Answers0