Skip to content
This repository was archived by the owner on Jan 27, 2026. It is now read-only.

Commit 99d3145

Browse files
authored
chore(cli): update error message (#2571)
This change updates the error message produced by the native replacement package to make it clear that native modules are not currently supported. This change also includes two small fixes suggested by sonarqube. Signed-off-by: Stan Lewis <gashcrumb@gmail.com>
1 parent 2acb6e0 commit 99d3145

File tree

3 files changed

+21
-15
lines changed

3 files changed

+21
-15
lines changed

.changeset/grumpy-bulldogs-sit.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

packages/cli/src/commands/export-dynamic-plugin/backend-embed-as-dependencies.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ ${
141141
path.join(target, 'embedded', toSuppress, 'index.js'),
142142
`
143143
throw new Error(
144-
'The package "${toSuppress}" has been marked as a native module and removed from this dynamic plugin package "${derivedPackageName}"'
144+
'The package "${toSuppress}" has been marked as a native module and removed from this dynamic plugin package "${derivedPackageName}", as native modules are not currently supported by dynamic plugins'
145145
);`,
146146
);
147147
}
@@ -233,11 +233,15 @@ throw new Error(
233233
})(path.join(embeddedDestDir, 'package.json'));
234234
}
235235

236-
const embeddedDependenciesResolutions: { [key: string]: any } = {};
237-
embeddedResolvedPackages.map(ep => {
238-
embeddedDependenciesResolutions[ep.packageName] =
239-
`file:./${embeddedPackageRelativePath(ep)}`;
240-
});
236+
const embeddedDependenciesResolutions = embeddedResolvedPackages.reduce(
237+
(resolutions, embeddedPkg) => ({
238+
...resolutions,
239+
...{
240+
[embeddedPkg.packageName]: `file:./${embeddedPackageRelativePath(embeddedPkg)}`,
241+
},
242+
}),
243+
{},
244+
);
241245

242246
if (opts.build) {
243247
Task.log(`Building main package`);

packages/cli/src/commands/export-dynamic-plugin/backend-utils.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,16 +89,16 @@ export function addToMainDependencies(
8989
Task.log(
9090
`The version of a dependency ('${dep}') of an embedded module differs from the main module's dependencies: '${dependenciesToAdd[dep]}', '${existingVersion}': keeping it as it is compatible`,
9191
);
92+
continue;
93+
}
94+
if (ignoreVersionCheck.includes(dep)) {
95+
Task.log(
96+
`The version of a dependency ('${dep}') of an embedded module conflicts with the main module's dependencies: '${dependenciesToAdd[dep]}', '${existingVersion}': however this has been overridden`,
97+
);
9298
} else {
93-
if (!ignoreVersionCheck.includes(dep)) {
94-
throw new Error(
95-
`The version of a dependency ('${dep}') of an embedded module conflicts with main module dependencies: '${dependenciesToAdd[dep]}', '${existingVersion}': cannot proceed!`,
96-
);
97-
} else {
98-
Task.log(
99-
`The version of a dependency ('${dep}') of an embedded module conflicts with the main module's dependencies: '${dependenciesToAdd[dep]}', '${existingVersion}': however this has been overridden`,
100-
);
101-
}
99+
throw new Error(
100+
`The version of a dependency ('${dep}') of an embedded module conflicts with main module dependencies: '${dependenciesToAdd[dep]}', '${existingVersion}': cannot proceed!`,
101+
);
102102
}
103103
}
104104
}

0 commit comments

Comments
 (0)