Skip to content

Commit d77710d

Browse files
committed
revert manifest
1 parent 6ec4188 commit d77710d

1 file changed

Lines changed: 3 additions & 34 deletions

File tree

packages/start/src/config/manifest.ts

Lines changed: 3 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -40,40 +40,9 @@ export function manifest(start: SolidStartOptions): PluginOption {
4040
v => "isEntry" in v && v.isEntry,
4141
);
4242
if (!entry) throw new Error("No client entry found");
43-
let viteStrVersion = (devServer?.config?.logger as any)?.config?.version;
44-
if (!viteStrVersion) {
45-
try {
46-
viteStrVersion = await import("vite").then(m => m.version);
47-
} catch (e) {
48-
// ignore
49-
}
50-
}
51-
52-
let rawManifest: string | undefined;
53-
54-
const viteMajor = parseInt(viteStrVersion!.split('.')[0], 10);
55-
56-
const manifestKey = Object.keys(globalThis.START_CLIENT_BUNDLE).find(k => k.endsWith("manifest.json"));
57-
if (manifestKey && viteMajor < 8) {
58-
const manifestAsset = globalThis.START_CLIENT_BUNDLE[manifestKey] as any;
59-
rawManifest = manifestAsset.source as string;
60-
} else {
61-
const fs = await import("node:fs");
62-
const path = await import("node:path");
63-
try {
64-
const appRoot = (start as any).appRoot || "./src";
65-
const manifestPath = path.resolve(appRoot, "..", ".solid-start/client/.vite/manifest.json");
66-
rawManifest = fs.readFileSync(manifestPath, "utf-8");
67-
} catch (e) {
68-
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}`);
69-
}
70-
}
71-
72-
if (!rawManifest) {
73-
throw new Error("Failed to extract or read raw manifest.");
74-
}
75-
76-
clientViteManifest = JSON.parse(rawManifest);
43+
clientViteManifest = JSON.parse(
44+
(globalThis.START_CLIENT_BUNDLE[".vite/manifest.json"] as any).source,
45+
);
7746
}
7847
return `export const clientViteManifest = ${JSON.stringify(clientViteManifest)};`;
7948
} else if (id === `\0${VIRTUAL_MODULES.middleware}`) return "export default {};";

0 commit comments

Comments
 (0)