Related plugins
Describe the bug
Hello 👋
It seems like the base option with Vite results in invalid chunk loading in browser environment:
For /src/client.tsx request goes to http://localhost:5173/examplesrc/client.tsx - while debugging I found this:
|
return __vite_rsc_raw_import__(import.meta.env.BASE_URL + id.slice(1)) |
It seems like there's a slice(1) call for some reason. If I locally patched it to remove the slice - it works correctly, but I'm not sure why it was there in the first place 😄
I hope my investigation is helpful, thanks a lot in advance!
Reproduction
https://github.com/pawelblaszczyk5/rsc-base-reproduction
Steps to reproduce
- Start with RSC default starter
- Add
base option to vite.config.ts
- Run dev server, observe the error of loading client chunk in browser
System Info
System:
OS: macOS 15.5
CPU: (8) arm64 Apple M1 Pro
Memory: 130.72 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 24.4.0 - ~/.local/state/fnm_multishells/2224_1752770938234/bin/node
npm: 11.4.2 - ~/.local/state/fnm_multishells/2224_1752770938234/bin/npm
pnpm: 10.13.1 - ~/.local/state/fnm_multishells/2224_1752770938234/bin/pnpm
bun: 1.1.33 - ~/.bun/bin/bun
Browsers:
Chrome: 138.0.7204.101
Edge: 120.0.2210.121
Safari: 18.5
npmPackages:
@vitejs/plugin-react: latest => 4.6.0
@vitejs/plugin-rsc: latest => 0.4.12
vite: ^7.0.4 => 7.0.5
Used Package Manager
pnpm
Logs
N/A here
Validations
Related plugins
plugin-react
plugin-react-swc
plugin-react-oxc
plugin-rsc
Describe the bug
Hello 👋
It seems like the
baseoption with Vite results in invalid chunk loading in browser environment:For
/src/client.tsxrequest goes tohttp://localhost:5173/examplesrc/client.tsx- while debugging I found this:vite-plugin-react/packages/plugin-rsc/src/browser.ts
Line 13 in df6a38e
It seems like there's a
slice(1)call for some reason. If I locally patched it to remove the slice - it works correctly, but I'm not sure why it was there in the first place 😄I hope my investigation is helpful, thanks a lot in advance!
Reproduction
https://github.com/pawelblaszczyk5/rsc-base-reproduction
Steps to reproduce
baseoption tovite.config.tsSystem Info
System: OS: macOS 15.5 CPU: (8) arm64 Apple M1 Pro Memory: 130.72 MB / 16.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 24.4.0 - ~/.local/state/fnm_multishells/2224_1752770938234/bin/node npm: 11.4.2 - ~/.local/state/fnm_multishells/2224_1752770938234/bin/npm pnpm: 10.13.1 - ~/.local/state/fnm_multishells/2224_1752770938234/bin/pnpm bun: 1.1.33 - ~/.bun/bin/bun Browsers: Chrome: 138.0.7204.101 Edge: 120.0.2210.121 Safari: 18.5 npmPackages: @vitejs/plugin-react: latest => 4.6.0 @vitejs/plugin-rsc: latest => 0.4.12 vite: ^7.0.4 => 7.0.5Used Package Manager
pnpm
Logs
N/A here
Validations