Skip to content

Commit

Permalink
fix(mf): __webpack_init_sharing__ with empty config (#6450)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahabhgk authored May 6, 2024
1 parent 7c68f97 commit 8179eec
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
it("should have single runtime chunk", () => {
__webpack_init_sharing__("default");
expect(typeof __webpack_require__.I).toBe("function")
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const { ModuleFederationPluginV1: ModuleFederationPlugin } = require("@rspack/core").container;

/** @type {import("@rspack/core").Configuration} */
module.exports = {
plugins: [
new ModuleFederationPlugin({}),
]
};
2 changes: 2 additions & 0 deletions packages/rspack/src/container/ModuleFederationPluginV1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { SharePlugin, Shared } from "../sharing/SharePlugin";
import { isValidate } from "../util/validate";
import { ContainerPlugin, Exposes } from "./ContainerPlugin";
import { ContainerReferencePlugin, Remotes } from "./ContainerReferencePlugin";
import { ShareRuntimePlugin } from "../sharing/ShareRuntimePlugin";

export interface ModuleFederationPluginV1Options {
exposes?: Exposes;
Expand Down Expand Up @@ -43,6 +44,7 @@ export class ModuleFederationPluginV1 {
compiler.options.output.enabledLibraryTypes!.push(library.type);
}
compiler.hooks.afterPlugins.tap("ModuleFederationPlugin", () => {
new ShareRuntimePlugin(this._options.enhanced).apply(compiler);
if (
options.exposes &&
(Array.isArray(options.exposes)
Expand Down

2 comments on commit 8179eec

@rspack-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ“ Benchmark detail: Open

task failure

@rspack-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ“ Ran ecosystem CI: Open

suite result
modernjs, self-hosted, Linux, ci βœ… success
_selftest, ubuntu-latest βœ… success
nx, ubuntu-latest βœ… success
rspress, ubuntu-latest βœ… success
rsbuild, ubuntu-latest βœ… success
compat, ubuntu-latest βœ… success
examples, ubuntu-latest βœ… success

Please sign in to comment.