Reproduction link or steps
https://github.com/ef81sp/rolldown-sanitize-filename-repro
What is expected?
JS chunk filenames should be sanitized (? and & replaced with _):
dist/components/TestComp.vue_vue_type_script_setup_true_lang.js
What is actually happening?
dist/components/TestComp.vue?vue&type=script&setup=true&lang.js
Custom sanitizeFileName in output options is also ignored for these chunks. CSS filenames are correctly sanitized in the same build.
This occurs when entry is object-form ({ index: './src/index.ts' }). With string-form entry ('./src/index.ts'), preserveModules does not preserve the directory structure at all, so the issue does not surface.
System Info
System:
OS: macOS 26.3.1
CPU: (8) arm64 Apple M1
Memory: 102.55 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 25.5.0 - /opt/homebrew/bin/node
pnpm: 10.28.0
npmPackages:
vite: 8.0.0 (rolldown 1.0.0-rc.9)
Any additional comments?
#7554 fixed sanitizeFileName for preserveModules, but only when entry is string-form. With object-form entry, sanitizeFileName is still not applied to JS chunk filenames.
Workaround: using entryFileNames as a function to manually sanitize works.
Reproduction link or steps
https://github.com/ef81sp/rolldown-sanitize-filename-repro
What is expected?
JS chunk filenames should be sanitized (
?and&replaced with_):What is actually happening?
Custom
sanitizeFileNamein output options is also ignored for these chunks. CSS filenames are correctly sanitized in the same build.This occurs when
entryis object-form ({ index: './src/index.ts' }). With string-form entry ('./src/index.ts'),preserveModulesdoes not preserve the directory structure at all, so the issue does not surface.System Info
System: OS: macOS 26.3.1 CPU: (8) arm64 Apple M1 Memory: 102.55 MB / 16.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 25.5.0 - /opt/homebrew/bin/node pnpm: 10.28.0 npmPackages: vite: 8.0.0 (rolldown 1.0.0-rc.9)Any additional comments?
#7554 fixed
sanitizeFileNameforpreserveModules, but only whenentryis string-form. With object-formentry,sanitizeFileNameis still not applied to JS chunk filenames.Workaround: using
entryFileNamesas a function to manually sanitize works.