Skip to content

fix: sanitize preserveModules chunk names from query ids#9289

Open
deltama37 wants to merge 5 commits into
rolldown:mainfrom
deltama37:fix-8761-sanitize-preserve-modules
Open

fix: sanitize preserveModules chunk names from query ids#9289
deltama37 wants to merge 5 commits into
rolldown:mainfrom
deltama37:fix-8761-sanitize-preserve-modules

Conversation

@deltama37

Copy link
Copy Markdown

Summary

Fixes #8761.

When output.preserveModules is enabled, Rolldown derives chunk names from module ids. For query-bearing module ids such as Vue SFC submodules:

components/TestComp.vue?vue&type=script&setup=true&lang

the generated JS chunk name could keep ?, &, and = in the output filename when using object-form entries.

This change applies the existing sanitizeFileName logic after the preserveModules chunk name has been assembled, so the emitted filename becomes:

components/TestComp.vue_vue_type_script_setup_true_lang.js

Test

Added a Node fixture covering a preserveModules build with an object-form entry and a Vue-style query module id.

just test-node-rolldown-only -t topics/preserve-modules/sanitize-filename-query

@codspeed-hq

codspeed-hq Bot commented May 3, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 4 untouched benchmarks
⏩ 10 skipped benchmarks1


Comparing deltama37:fix-8761-sanitize-preserve-modules (5f3e332) with main (867d78d)

Open in CodSpeed

Footnotes

  1. 10 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@sapphi-red sapphi-red left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please add the tests from #8817 and address the comments there

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.

[Bug]: sanitizeFileName is ignored for JS chunks when preserveModules: true with object-form entry

2 participants