Support repository-root WebUI packages
This commit is contained in:
+16
-3
@@ -75,6 +75,17 @@ function availableWebModuleSpecifiers(): string[] {
|
||||
return configuredWebModulePackages().filter(packageInstalled);
|
||||
}
|
||||
|
||||
function webModuleEntry(specifier: string): string | null {
|
||||
const root = packageDirectory(specifier);
|
||||
for (const candidate of [
|
||||
join(root, "src", "module.ts"),
|
||||
join(root, "webui", "src", "module.ts")
|
||||
]) {
|
||||
if (existsSync(candidate)) return candidate;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function deferredVendorChunk(id: string): string | undefined {
|
||||
const normalized = id.replaceAll("\\", "/");
|
||||
if (!normalized.includes("/node_modules/")) return undefined;
|
||||
@@ -167,9 +178,11 @@ function govoplanInstalledModulesPlugin(): Plugin {
|
||||
const publicVirtualId = id.slice(1);
|
||||
const specifier = specifierByModuleVirtualId.get(publicVirtualId);
|
||||
if (!specifier) return null;
|
||||
const moduleEntry = join(packageDirectory(specifier), "src", "module.ts");
|
||||
if (!existsSync(moduleEntry)) {
|
||||
throw new Error(`${specifier} does not expose src/module.ts`);
|
||||
const moduleEntry = webModuleEntry(specifier);
|
||||
if (!moduleEntry) {
|
||||
throw new Error(
|
||||
`${specifier} does not expose src/module.ts or webui/src/module.ts`
|
||||
);
|
||||
}
|
||||
// Import the contribution descriptor directly. Package root barrels may
|
||||
// intentionally re-export pages and would otherwise defeat route splitting.
|
||||
|
||||
Reference in New Issue
Block a user