-
Notifications
You must be signed in to change notification settings - Fork 22
Description
Hello there
I've got a project that makes use of module federation (just migrated from webpack to rsbuild) but now I can't get storybook to properly start up with my module federation dependency configured.
Here's the relevant part of my storybook / rsbuild config:
{
...
framework: 'storybook-react-rsbuild',
rsbuildFinal: (config) => {
return mergeRsbuildConfig(config, {
plugins: [pluginReact()],
moduleFederation: {
options: {
name: '_my_library',
filename: '_my_library.js',
remotes: {
_my_remote: '_my_remote@http://localhost:3050/_my_remote.js',
},
shared: {
react: { singleton: true },
'react-dom': { singleton: true },
},
},
},
});
},
}I don't think this library supports this usecase yet, as I'm getting errors after starting up the app.
The loadShareSync function was unable to load react. The react could not be found in _my_library.
Possible reasons for failure:
1. The react share was registered with the 'get' attribute, but loadShare was not used beforehand.
2. The react share was not registered with the 'lib' attribute.
When using webpack, I've managed to get module federation imports working by using storybook-module-federation. I suspect that this doesn't work yet because of the missing initial dynamic import. That seems to have been the issue with this similar issue here
So if I'm doing something wrong in using module federation together with storybook / rsbuild, please provide a working example or some guidance here. If it's not yet supported at all, please consider implementing it soon ❤️