Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,15 @@ export function TestCssQueriesClient(props: {
}) {
const [enabled, setEnabled] = React.useState(false)

function urlWithHmr(href: string) {
if (import.meta.hot) {
href += '?t=' + Date.now()
}
return href
}

return (
<div>
<button onClick={() => setEnabled(!enabled)}>test-css-queries</button>
{enabled && (
<>
<link rel="stylesheet" href={urlWithHmr(cssUrl)} />
<link rel="stylesheet" href={cssUrl} />
<style>{cssInline}</style>
<style>{cssRaw}</style>
<link rel="stylesheet" href={urlWithHmr(props.serverUrl)} />
<link rel="stylesheet" href={props.serverUrl} />
<style>{props.serverInline}</style>
<style>{props.serverRaw}</style>
</>
Expand Down
4 changes: 3 additions & 1 deletion packages/plugin-rsc/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,9 @@ export default function vitePluginRsc(
if (this.environment.name === 'client') {
// filter out `.css?direct` (injected by SSR) to avoid browser full reload
// when changing non-self accepting css such as `module.css`.
return ctx.modules.filter((m) => !m.id?.includes('?direct'))
return ctx.modules.filter(
(m) => !(m.id?.includes('?direct') && !m.isSelfAccepting),
)
Comment on lines +484 to +486
Copy link
Contributor Author

@hi-ogawa hi-ogawa Aug 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed by targeting non self-accepting case specifically. This likely means HMR doesn't work for xxx.module.css?url, but let's just postpone dealing with that edge case.

}
}

Expand Down
Loading