Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(mf): __webpack_init_sharing__ with empty config #6450

Merged
merged 1 commit into from
May 6, 2024
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
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
Loading