Skip to content

Shared module not working when cherry picking #51

@bchoddny

Description

@bchoddny

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'],
}),
],
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions