Repository navigation
Labels
bug: upstreamBug in a dependency of Vitep3-minor-bugAn edge case that only affects very specific usage (priority)
Description
Describe the bug
After migrating to newest Vite (Rolldown based), following config works improperly on Windows:
import { defineConfig } from 'vite';
export default defineConfig({
build: {
ssr: true,
ssrEmitAssets: true,
rollupOptions: {
input: ['src/bin/index.ts'],
output: {
preserveModules: true,
preserveModulesRoot: 'src',
},
},
},
});
Source structure:
src/
├─ bin/
│ ├─ index.ts
├─ lib/
│ ├─ helper.ts
assets/
├─ data.json
Output on Windows:
vite v8.0.14 building ssr environment for production...
✓ 4 modules transformed.
computing gzip size...
dist/assets/data.js 0.09 kB │ gzip: 0.09 kB
dist/src/lib/helper.js 0.12 kB │ gzip: 0.12 kB
dist/src/bin/index.js 0.19 kB │ gzip: 0.14 kB
Output on Linux (node:22.13 image):
vite v8.0.14 building ssr environment for production...
✓ 4 modules transformed.
computing gzip size...
dist/assets/data.js 0.09 kB │ gzip: 0.09 kB
dist/lib/helper.js 0.12 kB │ gzip: 0.12 kB
dist/bin/index.js 0.19 kB │ gzip: 0.14 kB
Seems to be similar to previously fixed #6509 but related to Rolldown.
Reproduction
https://stackblitz.com/edit/vitejs-vite-wybkjasr
Steps to reproduce
- Work on Windows
- Have file structure similar as above (
srcdirectory, and something outside ofsrc) - In
vite.config.ts, have definedssr: true,preserveModules: trueandpreserveModulesRoot: 'src' - Run
vite buildand check generated output (distlayout)
System Info
System:
OS: Windows 11 10.0.26200
CPU: (12) x64 AMD Ryzen 5 PRO 5650U with Radeon Graphics
Memory: 7.45 GB / 30.83 GB
Binaries:
Node: 22.22.3 - C:\Program Files\nodejs\node.EXE
npm: 10.9.8 - C:\Program Files\nodejs\npm.CMD
pnpm: 9.6.0 - C:\Users\rawi\AppData\Local\pnpm\pnpm.EXE
Browsers:
Chrome: 148.0.7778.179
Edge: Chromium (145.0.3800.97)
Internet Explorer: 11.0.26100.8115
npmPackages:
vite: ^8.0.14 => 8.0.14Used Package Manager
npm
Logs
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Metadata
Metadata
Assignees
Labels
bug: upstreamBug in a dependency of Vitep3-minor-bugAn edge case that only affects very specific usage (priority)
Activity
preserveModulesRootis not working on Windows with slash-normalized ids rolldown/rolldown#9593