Skip to content

Commit afa4da6

Browse files
committed
fix: fix css skip
1 parent 4b783f3 commit afa4da6

File tree

6 files changed

+20
-6
lines changed

6 files changed

+20
-6
lines changed
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
.test-css-inline-client {
2-
padding: 8px;
3-
margin: 4px;
2+
color: rgb(255, 50, 0);
43
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
.test-css-raw-client {
2-
font-weight: bold;
2+
color: rgb(255, 0, 0);
33
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
.test-css-url-client {
2-
border: 2px solid rgb(0, 0, 255);
2+
color: rgb(255, 100, 0);
33
}

packages/plugin-rsc/examples/basic/src/routes/css-queries/client.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,22 @@
33
import cssUrl from './client-url.css?url'
44
import cssInline from './client-inline.css?inline'
55
import cssRaw from './client-raw.css?raw'
6+
import React from 'react'
67

78
export function TestCssQueriesClient() {
9+
const [enabled, setEnabled] = React.useState(false)
810
return (
911
<div>
12+
<button onClick={() => setEnabled(!enabled)}>
13+
test-css-queries-client
14+
</button>
15+
{enabled && (
16+
<>
17+
<link rel="stylesheet" href={cssUrl} />
18+
<style>{cssInline}</style>
19+
<style>{cssRaw}</style>
20+
</>
21+
)}
1022
<div className="test-css-url-client">test-css-url-client: {cssUrl}</div>
1123
<div className="test-css-inline-client">
1224
test-css-inline-client:{' '}

packages/plugin-rsc/examples/basic/src/server.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export default async function handler(request: Request): Promise<Response> {
2626
`default-src 'self';`,
2727
// `unsafe-eval` is required during dev since React uses eval for findSourceMapURL feature
2828
`script-src 'self' 'nonce-${nonce}' ${import.meta.env.DEV ? `'unsafe-eval'` : ``};`,
29-
`style-src 'self' 'nonce-${nonce}';`,
29+
`style-src 'self' 'unsafe-inline';`,
3030
// allow blob: worker for Vite server ping shared worker
3131
import.meta.hot && `worker-src 'self' blob:;`,
3232
]

packages/plugin-rsc/src/plugin.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1684,7 +1684,10 @@ export function vitePluginRscCss(
16841684
}
16851685
for (const next of mod?.importedModules ?? []) {
16861686
if (next.id) {
1687-
if (isCSSRequest(next.id) && !hasSpecialCssQuery(next.id)) {
1687+
if (isCSSRequest(next.id)) {
1688+
if (hasSpecialCssQuery(next.id)) {
1689+
continue
1690+
}
16881691
cssIds.add(next.id)
16891692
} else {
16901693
recurse(next.id)

0 commit comments

Comments
 (0)