-
-
Notifications
You must be signed in to change notification settings - Fork 595
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(mf2): extra provide sharing data (#7408)
- Loading branch information
Showing
17 changed files
with
259 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
packages/rspack-test-tools/tests/configCases/container-1-5/provide-sharing-extra-data/App.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import React from "react"; | ||
|
||
export default () => { | ||
return `App rendered with [${React()}]`; | ||
}; |
19 changes: 19 additions & 0 deletions
19
...ges/rspack-test-tools/tests/configCases/container-1-5/provide-sharing-extra-data/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
it("should load the component from container", () => { | ||
return import("./App").then(({ default: App }) => { | ||
expect(App()).toBe("App rendered with [This is react 0.1.2]"); | ||
const sharingReact = __webpack_require__.initializeSharingData.scopeToSharingDataMapping.default[0]; | ||
// name: "react", version: "0", eager: 0, singleton: 1, requiredVersion: "*", strictVersion: 0 | ||
expect(sharingReact.name).toBe("react"); | ||
expect(sharingReact.version).toBe("0"); | ||
expect(sharingReact.eager).toBe(0); | ||
expect(sharingReact.singleton).toBe(1); | ||
expect(sharingReact.requiredVersion).toBe("*"); | ||
expect(sharingReact.strictVersion).toBe(0); | ||
const initOptionsReact = __webpack_require__.federation.initOptions.shared.react[0]; | ||
expect(initOptionsReact.version).toBe("0"); | ||
expect(initOptionsReact.eager).toBe(0); | ||
expect(initOptionsReact.singleton).toBe(1); | ||
expect(initOptionsReact.requiredVersion).toBe("*"); | ||
expect(initOptionsReact.strictVersion).toBe(0); | ||
}); | ||
}); |
3 changes: 3 additions & 0 deletions
3
...st-tools/tests/configCases/container-1-5/provide-sharing-extra-data/node_modules/react.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
...ck-test-tools/tests/configCases/container-1-5/provide-sharing-extra-data/rspack.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const { ModuleFederationPlugin } = require("@rspack/core").container; | ||
|
||
/** @type {import("@rspack/core").Configuration[]} */ | ||
module.exports = { | ||
output: { | ||
filename: "[name].js", | ||
uniqueName: "provide-sharing-extra-data" | ||
}, | ||
plugins: [ | ||
new ModuleFederationPlugin({ | ||
name: "container-provide-sharing-extra-data", | ||
shared: { | ||
react: { | ||
version: false, | ||
requiredVersion: false, | ||
singleton: true, | ||
strictVersion: false, | ||
} | ||
} | ||
}) | ||
] | ||
}; |
6 changes: 6 additions & 0 deletions
6
...pack-test-tools/tests/configCases/container-1-5/provide-sharing-extra-data/test.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/** @type {import("../../../..").TConfigCaseConfig} */ | ||
module.exports = { | ||
findBundle: function (i, options) { | ||
return "./main.js"; | ||
} | ||
}; |
Oops, something went wrong.
9e235b0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 Ran ecosystem CI: Open
9e235b0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 Benchmark detail: Open