Webpack Module Federation use shared dependency with multiple sub packages

Viewed 416

Right now I am using the Vaadin UI web components library in two different projects that use the Module Federation Plugin. One app depends on the code of the other one.

I've installed in both projects the main @vaadin/vaadin dependency, but I don't want to import the hole package in one app, because of the bundle size. The main Vaadin package includes different sub packages like @vaadin/vaadin-text-field.

For shared dependencies I am currently including @vaadin/vaadin-text-field. But what if I want to add extra web components or just use one web component in one app. Is it possible to somehow use the main @vaadin/vaadin project as a shared dependency without importing the hole package?

Example:

Both apps are using these shared dependencies:

shared: ['lit-element', '@vaadin/vaadin-text-field']

I would like to have it like this:

shared: ['lit-element', '@vaadin/vaadin']

and then importing import '@vaadin/vaadin-text-field' without any Webpack issues.

0 Answers
Related