Skip to content

The complete open source platform to run your entire marketplace. Storefront, vendor panel, admin console, and integrations in one enterprise-grade platform you own.

fix(cli): stop plugin:build racing itself for src/admin/index.mjs (#1427)

Viktor Holikc53991475288
diff --git a/packages/cli/src/commands/plugin-build.ts b/packages/cli/src/commands/plugin-build.ts
index f4f66b90b..355b73f6b 100644
--- a/packages/cli/src/commands/plugin-build.ts
+++ b/packages/cli/src/commands/plugin-build.ts
@@ -29,12 +29,16 @@ export const pluginBuild = new Command()
process.exit(1);
}
- const bundler = await import("@medusajs/admin-bundler");
const pluginsDistFolder = path.resolve(cwd, ".medusa/server");
+ // Medusa's `buildPluginAdminExtensions` is deliberately not run here: it
+ // writes the same `src/admin/index.{mjs,cjs}` that the admin pass below
+ // does, and concurrently, so the two race for the file. It also builds
+ // from a crawled entry, which discards an authored `src/admin/index.ts`
+ // and drops the Mercur externals — so when it won the race the plugin's
+ // real entry vanished.
const responses = await Promise.all([
compiler.buildPluginBackend(tsConfig),
- compiler.buildPluginAdminExtensions(bundler),
...(["admin", "vendor"] as const).map((app) =>
buildDashboardExtensions({
root: cwd,