MadaraUchiha-314 / rollup-plugin-module-federation

A rollup plugin for module federation
https://rollup-plugin-module-federation.netlify.app/packages/examples/project-a/dist/rollup/esm/
MIT License
17 stars 1 forks source link

Rewriting ExportNamedDeclaration is causing an issue with recursive imports of shared dependencies #16

Open MadaraUchiha-314 opened 11 months ago

MadaraUchiha-314 commented 11 months ago
const { __moduleExports } = await __federatedImport__('./__federated__shared__react.js');

Since v1.2.0 this is what is currently being generated.

This is mostly due to the intermediate files that are created by the commonjs plugin which rewrites the content of react package and rewrites the import of react in react-dom.

MadaraUchiha-314 commented 5 months ago

This is a key blocker for supporting nested dependencies from being federated. For eg. if the dependency tree looks something like this:

<root>
  - react
  - random_package (which only has CJS or UMD output)
    - react

Because the commonjs plugin transforms the actual module to something else which contains the exports statement, the rollup federation plugin is not able to parse it.