module-federation.github.io icon indicating copy to clipboard operation
module-federation.github.io copied to clipboard

Shared module not working when cherry picking

Open bchoddny opened this issue 3 years ago • 0 comments

I'm trying to cherry pick lodash module. In the module federation plugin configuration, i tried to share this module, but I noticed multiple instance of lodash is loaded, when hosting remote component. My understanding was, if remote component has lodash as dependency, it wont be loaded twice, if specified as shared. Does sharing works when cherry picking modules in a library? if not, what are the other options? Please advise.

import has from 'lodash/has';

My webpack module federation configuration:

const { ModuleFederationPlugin } = require('webpack').container; module.exports = { plugins: [ new ModuleFederationPlugin({ // adds lodash as shared module // version is inferred from package.json // there is no version check for the required version // so it will always use the higher version found shared: ['lodash'], }), ], };

bchoddny avatar Aug 11 '21 16:08 bchoddny