Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/blue-lizards-happen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@module-federation/rsbuild-plugin': patch
---

chore(rsbuild-plugin): revert sharedStrategy default value
8 changes: 8 additions & 0 deletions apps/website-new/docs/en/guide/troubleshooting/other.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,11 @@ new ModuleFederationPlugin({
...
})
```

## HMR failed

* Use [React Developer Tools](https://chromewebstore.google.com/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi)

* If shared is provided from online host, use [Module Federation DevTools](../basic/chrome-devtool), and click `Enable HMR` button .

![](@public/guide/chrome-devtools/mf-devtool-hmr.jpg)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions apps/website-new/docs/zh/guide/troubleshooting/other.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,11 @@ Uncaught TypeError: Cannot read properties on null (reading `useState`)
])
}
```

## HMR 失效

* 使用 [React Developer Tools](https://chromewebstore.google.com/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi)

* 若 shared 提供方是线上的 react ,那么需要使用 [Module Federation DevTools](../basic/chrome-devtool),并点击 `Enable HMR` 按钮

![](@public/guide/chrome-devtools/mf-devtool-hmr.jpg)
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export default createModuleFederationConfig({
remotes: {
'provider': 'rslib_provider@https://unpkg.com/module-federation-rslib-provider@latest/dist/mf/mf-manifest.json',
},
shareStrategy: 'loaded-first',
shared: {
react: { singleton: true },
'react-dom': { singleton: true },
Expand Down
3 changes: 0 additions & 3 deletions packages/rsbuild-plugin/src/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,6 @@ export const pluginModuleFederation = (
if (
!bundlerConfig.plugins!.find((p) => p && p.name === PLUGIN_NAME)
) {
if (!moduleFederationOptions.shareStrategy) {
moduleFederationOptions.shareStrategy = 'loaded-first';
}
bundlerConfig.plugins!.push(
new ModuleFederationPlugin(moduleFederationOptions),
);
Expand Down