diff --git a/.changeset/hungry-turtles-sin.md b/.changeset/hungry-turtles-sin.md new file mode 100644 index 0000000000..9a94b4d07c --- /dev/null +++ b/.changeset/hungry-turtles-sin.md @@ -0,0 +1,5 @@ +--- +"@janus-idp/cli": patch +--- + +fix(cli): adjust embedded module searching. The CLI attempts a require call to detect built embedded packages, this change adjusts the directory this require is attempted from to be at the level of discovered package instead of the dynamic plugin package. diff --git a/packages/cli/src/commands/export-dynamic-plugin/backend-embed-as-dependencies.ts b/packages/cli/src/commands/export-dynamic-plugin/backend-embed-as-dependencies.ts index 303927c2e1..04dba31df7 100644 --- a/packages/cli/src/commands/export-dynamic-plugin/backend-embed-as-dependencies.ts +++ b/packages/cli/src/commands/export-dynamic-plugin/backend-embed-as-dependencies.ts @@ -65,7 +65,7 @@ export async function backend(opts: OptionValues): Promise { pkg, packagesToEmbed, monoRepoPackages, - createRequire(`${paths.targetDir}/package.json`), + createRequire(path.join(paths.targetDir, 'package.json')), [], ); const embeddedPackages = embeddedResolvedPackages.map(e => e.packageName); @@ -614,13 +614,13 @@ async function searchEmbedded( parentPackageName: pkg.name, alreadyPacked, }); - + // scan for embedded packages under the resolved package resolved.push( ...(await searchEmbedded( resolvedPackage, embedded, monoRepoPackages, - req, + createRequire(path.join(resolvedPackageDir, 'package.json')), [...alreadyResolved, ...resolved], )), );