Skip to content

fix(rsc): inject __vite_rsc_importer_resources import only once - #742

Merged
hi-ogawa merged 2 commits into
mainfrom
08-20-fix_rsc_inject___vite_rsc_importer_resources_import_only_once
Aug 20, 2025
Merged

hi-ogawa merged 2 commits into
mainfrom
08-20-fix_rsc_inject___vite_rsc_importer_resources_import_only_once

Conversation

@hi-ogawa

@hi-ogawa hi-ogawa commented Aug 20, 2025 •

Copy link
Copy Markdown
Contributor

Description

Previously each import.meta.viteRsc.loadCss() adds import __vite_rsc_importer_resources_xxx from "..." and it causes a name crash when they are added multiple times (either manually or due to auto loadCss injection). For example:

✗ Build failed in 32ms
error during build:
src/root.tsx (10:6): Identifier "__vite_rsc_importer_resources_366c10439797" has already been declared
file: /home/hiroshi/code/others/vite-plugin-react/packages/plugin-rsc/examples/starter/src/root.tsx:10:6

 8:   return (
 9:     <html lang="en">
10:       <head>
          ^
11:         <meta charSet="UTF-8" />
12:         <link rel="icon" type="image/svg+xml" href="/vite.svg" />

@hi-ogawa
hi-ogawa marked this pull request as ready for review August 20, 2025 00:35
@hi-ogawa
hi-ogawa merged commit 5b28ba5 into main Aug 20, 2025
@hi-ogawa
hi-ogawa deleted the 08-20-fix_rsc_inject___vite_rsc_importer_resources_import_only_once branch August 20, 2025 00:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant