Skip to content

Commit f83c467

Browse files
committed
fix: dont server render url imported css
1 parent b874152 commit f83c467

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

packages/start/src/server/collect-styles.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,10 @@ export async function findStylesInModuleGraph(
167167
for (const dep of dependencies) {
168168
if (isCssFile(dep.url)) {
169169
let depURL = dep.url;
170+
if (depURL.endsWith("?url")) {
171+
continue;
172+
}
173+
170174
if (!isCssUrlWithoutSideEffects(depURL)) {
171175
depURL = injectQuery(dep.url, "inline");
172176
}

packages/start/src/server/manifest/prod-ssr-manifest.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { clientViteManifest } from "solid-start:client-vite-manifest";
22
import { join } from "pathe";
3+
import { Manifest } from "vite";
34
import type { Asset } from "../renderAsset.tsx";
45

56
// Only reads from client manifest atm, might need server support for islands
@@ -66,7 +67,7 @@ function createHtmlTagsForAssets(assets: string[]) {
6667
}
6768

6869
function findAssetsInViteManifest(
69-
manifest: any,
70+
manifest: Manifest,
7071
id: string,
7172
assetMap = new Map(),
7273
stack: string[] = [],
@@ -85,7 +86,8 @@ function findAssetsInViteManifest(
8586
}
8687

8788
const assets = [
88-
...(chunk.assets?.filter(Boolean) || []),
89+
// TODO: Needs a better way to detect ?url
90+
...(chunk.assets?.filter(a => !a.endsWith('.css')) || []),
8991
...(chunk.css?.filter(Boolean) || []),
9092
];
9193
if (chunk.imports) {
@@ -94,7 +96,7 @@ function findAssetsInViteManifest(
9496
assets.push(
9597
...findAssetsInViteManifest(
9698
manifest,
97-
chunk.imports[i],
99+
chunk.imports[i]!,
98100
assetMap,
99101
stack,
100102
),

0 commit comments

Comments
 (0)