react-imported-component icon indicating copy to clipboard operation
react-imported-component copied to clipboard

Unknown mark error with Module Federation SSR

Open eon-lee96 opened this issue 5 years ago • 0 comments

Version

Latest

Reproduction link

https://github.com/eon-lee96/my-mf-ssr-example

Steps to reproduce

Just follow the README to run demo

What is actually happening?

For short: nesting import cross two builds

Both Website1 and Website2 have their own imported.js. Website1 consumed a shared component(SomeComponent) from Website2 by using dynamic import. And SomeComponent also import an async component.

In server side, it work as expected----created all marks.

In client side, it cause Error: react-imported-component: unknown mark. I think this is because the marks on the server side created are inconsistent with the LOADABLE_MARKS in the client bundle.

After calling rehydrateMarks, the LOADABLE_MARKS may be correct, depends on the level of nesting

I have tried my best to solve it (https://github.com/theKashey/react-imported-component/compare/master...eon-lee96:master). It works fine in demo, But i am not sure if this is the best solution

eon-lee96 avatar Jan 11 '21 10:01 eon-lee96