fix(FN-3888): resolve dependency-graph plugin from src in dashboard build

The dashboard dynamically imports `@fusion-plugin-examples/dependency-graph/dashboard-view`, which resolved through the plugin's package.json exports to `dist/`. When plugin source was edited without rebuilding, stale `dist/` (extensionless ESM imports) made the import throw and the UI surfaced "Bundled plugin view unavailable". Add vite/vitest aliases mapping the plugin (and its `/dashboard-view` subpath) to `src/` so the dashboard never depends on `dist/`. Mirrors the existing pattern for hermes/openclaw/paperclip runtimes. Also extends the runtime-plugin alias regression test, and emits `.js` extensions from the plugin source for the CLI-bundled path.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-05-09 16:44:44 -07:00
parent 98b9e25ca4
commit 958af16ded
15 changed files with 90 additions and 25 deletions

View File

@@ -22,4 +22,25 @@ describe("FN-3298 regression: dashboard vitest runtime plugins resolve from sour
expect(config).not.toContain('fusion-plugin-openclaw-runtime/dist/index.js');
expect(config).not.toContain('fusion-plugin-paperclip-runtime/dist/index.js');
});
// FN-3888 regression: bundled dependency-graph dashboard view must not depend
// on plugins/fusion-plugin-dependency-graph/dist/, which goes stale when the
// plugin source is edited without a manual rebuild and surfaces in the UI as
// "Bundled plugin view unavailable: @fusion-plugin-examples/dependency-graph/dashboard-view".
it("aliases dependency-graph plugin imports to src in vite and vitest configs", () => {
const testDir = dirname(fileURLToPath(import.meta.url));
const dashboardDir = join(testDir, "..", "..");
for (const configFile of ["vite.config.ts", "vitest.config.ts"]) {
const config = readFileSync(join(dashboardDir, configFile), "utf8");
expect(
config,
`${configFile} must alias the dependency-graph dashboard-view to src`,
).toContain('"@fusion-plugin-examples/dependency-graph/dashboard-view": resolve(');
expect(config).toContain(
'"../../plugins/fusion-plugin-dependency-graph/src/dashboard-view.tsx"',
);
expect(config).not.toContain("fusion-plugin-dependency-graph/dist/");
}
});
});