Skip to content

Commit b47ea35

Browse files
Fix no remote (#52)
* fix: no remote entry emitted causes failures in validation * fix: no remote entry emitted causes failures in validation
1 parent b72453f commit b47ea35

File tree

4 files changed

+23
-17
lines changed

4 files changed

+23
-17
lines changed

.changeset/angry-hairs-remember.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@module-federation/dashboard": minor
3+
"@module-federation/dashboard-plugin": minor
4+
---
5+
6+
Documentation Formatting and fixing a bug in the pluign that happens when no remoteEntry is emitted at all

dashboard-fe/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ Add the `DashboardPlugin` to the `plugins` array.
3939

4040
```js
4141
plugins: [
42-
...
43-
new DashboardPlugin({
42+
...new DashboardPlugin({
4443
dashboardURL: "http://localhost:3000/api/update",
4544
}),
4645
];

dashboard-plugin/README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ const DashboardPlugin = require("@module-federation/dashboard-plugin");
1616

1717
```js
1818
plugins: [
19-
...
20-
new DashboardPlugin({
19+
...new DashboardPlugin({
2120
dashboardURL: "http://localhost:3000/api/update",
2221
}),
2322
];
@@ -35,12 +34,11 @@ There are also other options:
3534

3635
## Metadata
3736

38-
Metadata is *optional* and is specified as an object.
37+
Metadata is _optional_ and is specified as an object.
3938

4039
```js
4140
plugins: [
42-
...
43-
new DashboardPlugin({
41+
...new DashboardPlugin({
4442
dashboardURL: "http://localhost:3000/api/update",
4543
metadata: {
4644
source: {

dashboard-plugin/helpers/index.js

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,25 @@ function validateParams({
1111
);
1212
}
1313

14-
const hasLoc = objHasKeys(federationRemoteEntry, ["origins", "0", "loc"]);
14+
const hasLoc = federationRemoteEntry
15+
? objHasKeys(federationRemoteEntry, ["origins", "0", "loc"])
16+
: federationRemoteEntry;
17+
1518
const hasDependencies = objHasKeys(topLevelPackage, ["dependencies"]);
1619
const hasDevDependencies = objHasKeys(topLevelPackage, ["devDependencies"]);
1720
const hasOptionalDependencies = objHasKeys(topLevelPackage, [
1821
"optionalDependencies",
1922
]);
20-
21-
if (
22-
typeof hasLoc === "undefined" ||
23-
federationRemoteEntry.origins[0].loc === ""
24-
) {
25-
throw new Error(
26-
"federationRemoteEntry.origins[0].loc must be defined and have a value"
27-
);
23+
if (federationRemoteEntry) {
24+
if (
25+
typeof hasLoc === "undefined" ||
26+
federationRemoteEntry.origins[0].loc === ""
27+
) {
28+
throw new Error(
29+
"federationRemoteEntry.origins[0].loc must be defined and have a value"
30+
);
31+
}
2832
}
29-
3033
if ((modules && !modules.length) || typeof modules === "undefined") {
3134
throw new Error("Modules must be defined and have length");
3235
}

0 commit comments

Comments
 (0)