From 9d9dfcdf99d7eec064dbe0cb07b5f09cd81c9c9f Mon Sep 17 00:00:00 2001 From: "zhanghang.heal" Date: Tue, 16 Apr 2024 13:07:37 +0800 Subject: [PATCH 1/2] chore: every container should has unique name --- .../module-federation-with-shareScope/webpack.config.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webpack-test/configCases/container/module-federation-with-shareScope/webpack.config.js b/webpack-test/configCases/container/module-federation-with-shareScope/webpack.config.js index 918ad006d5d..5bd174d1f69 100644 --- a/webpack-test/configCases/container/module-federation-with-shareScope/webpack.config.js +++ b/webpack-test/configCases/container/module-federation-with-shareScope/webpack.config.js @@ -31,7 +31,7 @@ module.exports = [ }, plugins: [ new ModuleFederationPlugin({ - name: "container", + name: "containerCjs", library: { type: "commonjs-module" }, filename: "container.js", remotes: { @@ -53,7 +53,7 @@ module.exports = [ }, plugins: [ new ModuleFederationPlugin({ - name: "container", + name: "containerEsm", library: { type: "module" }, filename: "module/container.mjs", remotes: { From 6aeecbd2daacd7189810a01a2e8917b993863b68 Mon Sep 17 00:00:00 2001 From: "zhanghang.heal" Date: Tue, 16 Apr 2024 17:46:13 +0800 Subject: [PATCH 2/2] fix: containerShareScope should get value by shareScope key --- packages/rspack/src/container/default.runtime.js | 2 +- .../module-federation-with-shareScope/webpack.config.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/rspack/src/container/default.runtime.js b/packages/rspack/src/container/default.runtime.js index 86579f98f5b..a08e8457451 100644 --- a/packages/rspack/src/container/default.runtime.js +++ b/packages/rspack/src/container/default.runtime.js @@ -42,7 +42,7 @@ module.exports = function () { const initializeSharingInitPromises = []; const initializeSharingInitTokens = []; const containerShareScope = - __webpack_require__.initializeExposesData?.containerShareScope; + __webpack_require__.initializeExposesData?.shareScope; early( __webpack_require__, diff --git a/webpack-test/configCases/container/module-federation-with-shareScope/webpack.config.js b/webpack-test/configCases/container/module-federation-with-shareScope/webpack.config.js index 5bd174d1f69..918ad006d5d 100644 --- a/webpack-test/configCases/container/module-federation-with-shareScope/webpack.config.js +++ b/webpack-test/configCases/container/module-federation-with-shareScope/webpack.config.js @@ -31,7 +31,7 @@ module.exports = [ }, plugins: [ new ModuleFederationPlugin({ - name: "containerCjs", + name: "container", library: { type: "commonjs-module" }, filename: "container.js", remotes: { @@ -53,7 +53,7 @@ module.exports = [ }, plugins: [ new ModuleFederationPlugin({ - name: "containerEsm", + name: "container", library: { type: "module" }, filename: "module/container.mjs", remotes: {