Tom Sherman
Tom Sherman
Zack and I had a workshop yesterday and we managed to get sync imports working. See https://github.com/zamotany/module-federation-repack/compare/main...tom-sherman:module-federation-repack:c273eaa94c55bbdf761f313c2ce8c86349b47ac3 Later I'll expand on what I think needs to change in repack to...
I think the main thing that got this working was initialising the default shared scope manually: https://github.com/tom-sherman/module-federation-repack/blob/466d5fddcb22391c380ebbe5b4583415c311721d/host/index.js#L6-L8
@zamotany Is this work being done in the open? I'd love to take a look! Edit: Ah saw your other comment https://github.com/callstack/repack/projects/4
@zamotany I've tried this but I can't even get the code inside the remote string to execute, just get the same error about react-native not being available for eager consumption....
@zamotany I just tried that and got a `import declaration must be at top level of module` error message, hermes cannot parse the JS with the import there and I...
@zamotany Same error. The code string in `remotes` isn't being evaluated at all.
We accomplished something similar in the end using `external` and setting `ChunkManager` to the `__repack__` global. Also needed `if(!__webpack_share_scopes__.default) __webpack_init_sharing__('default');` at the top of index.js. See https://github.com/zamotany/module-federation-repack/compare/main...tom-sherman:module-federation-repack:c273eaa94c55bbdf761f313c2ce8c86349b47ac3 This also unlocked...
My fix linked above is the solution we're going with for now. I believe there needs to be some changes inside of repack to allow `import()` and known remotes (#9)...
I think there's some prior art on the web: https://github.com/module-federation/module-federation-examples/blob/master/react-hmr/README.md Is there anything that can be taken and ported to native? Would this model work? Or is there some drawback...
Bumping again, any updates?