Skip to content

Conversation

@hi-ogawa
Copy link
Owner

@hi-ogawa hi-ogawa commented Aug 23, 2025

Part of vitejs/vite-plugin-react#743

It looks like build is broken.

> vite build

vite v7.1.3 building SSR bundle for production...
[plugin unocss:global:build:scan] [unocss] "virtual:uno.css" is being imported multiple times in different files, using the first occurrence: "/home/hiroshi/code/personal/reproductions/vite-rsc-unocss/src/__uno.css"
[plugin unocss:global:build:scan] [unocss] "virtual:uno.css" is being imported multiple times in different files, using the first occurrence: "/home/hiroshi/code/personal/reproductions/vite-rsc-unocss/src/__uno.css" (x2)
✓ 54 modules transformed.
[plugin unocss:global:build:generate] [unocss] failed to find vite:css-post plugin. It might be an internal bug of UnoCSS
✓ built in 250ms
vite v7.1.3 building SSR bundle for production...
✓ 50 modules transformed.
✓ built in 223ms
vite v7.1.3 building SSR bundle for production...
[plugin unocss:global:build:scan] [unocss] "virtual:uno.css" is being imported multiple times in different files, using the first occurrence: "/home/hiroshi/code/personal/reproductions/vite-rsc-unocss/src/__uno.css"
[plugin unocss:global:build:scan] [unocss] "virtual:uno.css" is being imported multiple times in different files, using the first occurrence: "/home/hiroshi/code/personal/reproductions/vite-rsc-unocss/src/__uno.css" (x2)
✓ 54 modules transformed.
[plugin unocss:global:build:generate] [unocss] failed to find vite:css-post plugin. It might be an internal bug of UnoCSS
[plugin vite:reporter] 
(!) /home/hiroshi/code/personal/reproductions/vite-rsc-unocss/src/action.tsx is dynamically imported by virtual:vite-rsc/server-references but also statically imported by /home/hiroshi/code/personal/reproductions/vite-rsc-unocss/src/root.tsx, dynamic import will not move module into another chunk.

dist/rsc/assets/index-BRYPp0om.css    1.45 kB
dist/rsc/index.js                   472.04 kB
✓ built in 448ms
vite v7.1.3 building for production...
✓ 40 modules transformed.
dist/client/assets/index-BRYPp0om.css    1.45 kB │ gzip:  0.75 kB
dist/client/assets/client-B6VVadz3.js    0.19 kB │ gzip:  0.18 kB
dist/client/assets/index-Bx4hZ71J.js   213.10 kB │ gzip: 67.41 kB
✓ built in 401ms
vite v7.1.3 building SSR bundle for production...
✓ 50 modules transformed.
dist/ssr/assets/client-Te7tlATM.js      0.41 kB
dist/ssr/index.js                   1,352.92 kB
✓ built in 611ms

This is worked around by adding top-level build outDir. Unocss doesn't support per-environment build config https://github.com/unocss/unocss/blob/1bcc90169a024b53844910f0df1bc5929fb8210b/packages-integrations/vite/src/modes/global/build.ts#L128

@hi-ogawa hi-ogawa marked this pull request as ready for review August 23, 2025 08:02
Comment on lines +20 to +26
build: {
// https://github.com/unocss/unocss/blob/1bcc90169a024b53844910f0df1bc5929fb8210b/packages-integrations/vite/src/modes/global/build.ts#L128
// workaround since unocss doesn't check per-environment `outDir`.
// otherwise build style breaks with
// > [plugin unocss:global:build:generate] [unocss] failed to find vite:css-post plugin. It might be an internal bug of UnoCSS
outDir: "dist/rsc",
}
Copy link
Owner Author

Choose a reason for hiding this comment

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

Here is a workaround.

@hi-ogawa hi-ogawa merged commit dd0a651 into main Aug 23, 2025
@hi-ogawa hi-ogawa deleted the 08-23-chore_add_vite-rsc-unocss branch August 23, 2025 08:03
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