fix(vite): serve css imported in islands (#3272)

Fixes https://github.com/denoland/fresh/issues/3271
This commit is contained in:
Marvin Hagemeister
2025-08-29 14:30:00 +02:00
committed by GitHub
parent b2c4f049bc
commit b41c151de3
14 changed files with 108 additions and 25 deletions
+4 -2
View File
@@ -27,6 +27,7 @@ export interface IslandModChunk {
name: string;
server: string;
browser: string | null;
css: string[];
}
export type FsRouteFileNoMod<State> = Omit<FsRouteFile<State>, "mod"> & {
@@ -206,7 +207,7 @@ export class MemoryBuildCache<State> implements DevBuildCache<State> {
throw new Error(`Unexpected missing browser chunk`);
}
preparer.prepare(this.islandRegistry, mod, chunk.browser, name);
preparer.prepare(this.islandRegistry, mod, chunk.browser, name, []);
},
),
);
@@ -461,7 +462,8 @@ export async function generateSnapshotServer(
const islandMarkers = islands.map((item) => {
const browser = JSON.stringify(item.browser);
const name = JSON.stringify(item.name);
return `islandPreparer.prepare(islands, ${item.name}, ${browser}, ${name});`;
const css = JSON.stringify(item.css);
return `islandPreparer.prepare(islands, ${item.name}, ${browser}, ${name}, ${css});`;
}).join("\n");
const serializedFsRoutes = fsRoutesFiles