Skip to content

Commit b0ffe95

Browse files
committed
dynamic manifest path
1 parent 613985f commit b0ffe95

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

packages/start/src/config/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,9 @@ export function solidStart(options?: SolidStartOptions): Array<PluginOption> {
243243
{
244244
name: "solid-start:capture-client-bundle",
245245
enforce: "post",
246-
generateBundle(_options, bundle) {
246+
generateBundle(options, bundle) {
247247
globalThis.START_CLIENT_BUNDLE = bundle;
248+
(globalThis as any).START_CLIENT_OUT_DIR = options.dir;
248249
},
249250
},
250251
devServer(),

packages/start/src/config/manifest.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,15 @@ export function manifest(start: SolidStartOptions): PluginOption {
6262
const path = await import("node:path");
6363
try {
6464
const appRoot = (start as any).appRoot || "./src";
65-
const manifestPath = path.resolve(appRoot, "..", ".solid-start/client/.vite/manifest.json");
65+
let outDir = ".solid-start/client";
66+
if (devServer?.environments?.client?.config?.build?.outDir) {
67+
outDir = devServer.environments.client.config.build.outDir;
68+
} else if (this.environment?.config?.build?.outDir && this.environment?.config?.consumer === "client") {
69+
outDir = this.environment.config.build.outDir;
70+
} else if ((globalThis as any).START_CLIENT_OUT_DIR) {
71+
outDir = (globalThis as any).START_CLIENT_OUT_DIR;
72+
}
73+
const manifestPath = path.resolve(appRoot, "..", outDir, ".vite/manifest.json");
6674
rawManifest = fs.readFileSync(manifestPath, "utf-8");
6775
} catch (e) {
6876
throw new Error(`Manifest asset not found in bundle and could not be read from disk. Keys: ${Object.keys(globalThis.START_CLIENT_BUNDLE).join(", ")}. Error: ${e}`);

0 commit comments

Comments
 (0)