module-federation-examples icon indicating copy to clipboard operation
module-federation-examples copied to clipboard

nested paths, optimizations and bundle size effects on shared vendor

Open wibed opened this issue 1 year ago • 0 comments

taken from examples here: https://github.com/module-federation/module-federation-examples/tree/master/advanced-api

...
const deps = require('./package.json').dependencies;
...
      shared: {
        moment: deps.moment,
...

will load the moment.js package from the module with the highest version.

the comment here: https://github.com/module-federation/module-federation-examples/blob/master/advanced-api/automatic-vendor-sharing/app1/rspack.config.js

// adds all your dependencies as shared modules
// version is inferred from package.json in the dependencies
// requiredVersion is used from your package.json
// dependencies will automatically use the highest available package
// in the federated app, based on version requirement in package.json
// multiple different versions might coexist in the federated app
// Note that this will not affect nested paths like "lodash/pluck"
// Note that this will disable some optimization on these packages
// with might lead the bundle size problems

what does will not affect nested paths meant exactly? what kind of optimizations are meant exactly? what kind of bundle size problem do i have to expect?

wibed avatar Jan 15 '24 08:01 wibed