Skip to content

Commit 7d71301

Browse files
fix: IAG issues (#433)
- incorrect remote ID when @syntax is different from alias key - hardcoded path seperator breaking windows backtick builds - remove hardcoded webpack version
1 parent 1a3eb98 commit 7d71301

File tree

8 files changed

+19
-9
lines changed

8 files changed

+19
-9
lines changed

dashboard-example/dsl/webpack.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ module.exports = {
7474
plugins: [
7575
new ModuleFederationPlugin({
7676
name: "dsl__REMOTE_VERSION__",
77-
library: { type: "var", name: "dsl__REMOTE_VERSION__" },
7877
filename: "remoteEntry.js",
7978
remotes: {},
8079
exposes: {

dashboard-example/home/webpack.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,9 @@ module.exports = {
7979
new ModuleFederationPlugin({
8080
name: "home",
8181
filename: "remoteEntry.js",
82-
library: { type: "var", name: "home" },
8382
remotes: {
83+
// dsl: "myDSL@http://things.com/remotes/dsl/remoteEntry.js",
84+
8485
dsl: DashboardPlugin.clientVersion({
8586
currentHost: "home",
8687
remoteName: "dsl",

dashboard-example/nav/webpack.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ module.exports = {
7373
plugins: [
7474
new ModuleFederationPlugin({
7575
name: "nav__REMOTE_VERSION__",
76-
library: { type: "var", name: "nav__REMOTE_VERSION__" },
7776
filename: "remoteEntry.js",
7877
remotes: {
7978
dsl: DashboardPlugin.clientVersion({

dashboard-example/search/webpack.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ module.exports = {
7373
plugins: [
7474
new ModuleFederationPlugin({
7575
name: "search__REMOTE_VERSION__",
76-
library: { type: "var", name: "search__REMOTE_VERSION__" },
7776
filename: "remoteEntry.js",
7877
remotes: {
7978
nav: DashboardPlugin.clientVersion({

dashboard-example/utils/webpack.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ module.exports = {
5757
}),
5858
new ModuleFederationPlugin({
5959
name: "utils__REMOTE_VERSION__",
60-
library: { type: "var", name: "utils__REMOTE_VERSION__" },
6160
filename: "remoteEntry.js",
6261
remotes: {},
6362
exposes: {

dashboard-plugin/FederationDashboardPlugin.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ class FederationDashboardPlugin {
235235
this.parseModuleAst(curCompiler);
236236
}
237237

238-
// fs.writeFile('stats.json', JSON.stringify(stats.modules))
238+
// fs.writeFileSync('stats.json', JSON.stringify(stats, null, 2))
239239

240240
// get RemoteEntryChunk
241241
const RemoteEntryChunk = this.getRemoteEntryChunk(
@@ -251,6 +251,7 @@ class FederationDashboardPlugin {
251251

252252
const rawData = {
253253
name: this.FederationPluginOptions.name,
254+
remotes: this.FederationPluginOptions.remotes,
254255
metadata: this._options.metadata || {},
255256
topLevelPackage: vendorFederation || {},
256257
publicPath: stats.publicPath,

dashboard-plugin/convertToGraph.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ const convertToGraph = (
3939
functionRemotes,
4040
sha,
4141
buildHash,
42+
remotes
4243
},
4344
standalone
4445
) => {
@@ -60,9 +61,20 @@ const convertToGraph = (
6061
if (moduleType === "remote-module") {
6162
if (data.length === 4) {
6263
const name = data[3].replace("./", "");
64+
const remoteApplicationAlias = data[2].replace("webpack/container/reference/", "");
65+
const remoteFromPluginOptions = remotes[remoteApplicationAlias];
66+
let remoteGlobal = remoteApplicationAlias;
67+
if(typeof remoteFromPluginOptions === "string" &&
68+
!remoteFromPluginOptions.startsWith('external ') &&
69+
!remoteFromPluginOptions.startsWith('promise ') &&
70+
!remoteFromPluginOptions.startsWith('internal ') &&
71+
remoteFromPluginOptions.includes('@')) {
72+
remoteGlobal = remoteFromPluginOptions.split('@')[0];
73+
}
74+
6375
const consume = {
6476
consumingApplicationID: app,
65-
applicationID: data[2].replace("webpack/container/reference/", ""),
77+
applicationID: remoteGlobal,
6678
name,
6779
usedIn: new Set(),
6880
};
@@ -91,7 +103,7 @@ const convertToGraph = (
91103
});
92104
} else if (nameForCondition && nameForCondition.includes("node_modules")) {
93105
const contextArray = nameForCondition.split(path.sep);
94-
const afterModule = nameForCondition.split("node_modules/");
106+
const afterModule = nameForCondition.split("node_modules" + path.sep);
95107

96108
const search = afterModule[1] && afterModule[1].startsWith("@") ? 3 : 2;
97109
contextArray.splice(contextArray.indexOf("node_modules") + search);

dashboard-plugin/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"node-fetch": "^2.6.0"
4040
},
4141
"peerDependencies": {
42-
"webpack": "5.61.0",
42+
"webpack": "^5.40.0",
4343
"webpack-sources": "^1.4.3 || ^2.0.0"
4444
},
4545
"devDependencies": {

0 commit comments

Comments
 (0)