Skip to content
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
6 changes: 6 additions & 0 deletions .changeset/angry-hairs-remember.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@module-federation/dashboard": minor
"@module-federation/dashboard-plugin": minor
---

Documentation Formatting and fixing a bug in the pluign that happens when no remoteEntry is emitted at all
3 changes: 1 addition & 2 deletions dashboard-fe/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ Add the `DashboardPlugin` to the `plugins` array.

```js
plugins: [
...
new DashboardPlugin({
...new DashboardPlugin({
dashboardURL: "http://localhost:3000/api/update",
}),
];
Expand Down
8 changes: 3 additions & 5 deletions dashboard-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ const DashboardPlugin = require("@module-federation/dashboard-plugin");

```js
plugins: [
...
new DashboardPlugin({
...new DashboardPlugin({
dashboardURL: "http://localhost:3000/api/update",
}),
];
Expand All @@ -35,12 +34,11 @@ There are also other options:

## Metadata

Metadata is *optional* and is specified as an object.
Metadata is _optional_ and is specified as an object.

```js
plugins: [
...
new DashboardPlugin({
...new DashboardPlugin({
dashboardURL: "http://localhost:3000/api/update",
metadata: {
source: {
Expand Down
23 changes: 13 additions & 10 deletions dashboard-plugin/helpers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,25 @@ function validateParams({
);
}

const hasLoc = objHasKeys(federationRemoteEntry, ["origins", "0", "loc"]);
const hasLoc = federationRemoteEntry
? objHasKeys(federationRemoteEntry, ["origins", "0", "loc"])
: federationRemoteEntry;

const hasDependencies = objHasKeys(topLevelPackage, ["dependencies"]);
const hasDevDependencies = objHasKeys(topLevelPackage, ["devDependencies"]);
const hasOptionalDependencies = objHasKeys(topLevelPackage, [
"optionalDependencies",
]);

if (
typeof hasLoc === "undefined" ||
federationRemoteEntry.origins[0].loc === ""
) {
throw new Error(
"federationRemoteEntry.origins[0].loc must be defined and have a value"
);
if (federationRemoteEntry) {
if (
typeof hasLoc === "undefined" ||
federationRemoteEntry.origins[0].loc === ""
) {
throw new Error(
"federationRemoteEntry.origins[0].loc must be defined and have a value"
);
}
}

if ((modules && !modules.length) || typeof modules === "undefined") {
throw new Error("Modules must be defined and have length");
}
Expand Down