fix: support array inputs and fixed-string entryFileNames #208
Open
EvilFaeton wants to merge 2 commits intosxzz:mainfrom
Open
fix: support array inputs and fixed-string entryFileNames #208EvilFaeton wants to merge 2 commits intosxzz:mainfrom
EvilFaeton wants to merge 2 commits intosxzz:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I'm not super familiar with the rolldown plugin internals, so I used Claude Code to help trace issue back through plugin hooks, understand fake-js architecture, and validate that my fix was correct and backward-compatible (hopefully).
So, I'm checking those boxes:
Description
Hey! I ran into this while migrating monorepo from
vite-plugin-dts+@microsoft/api-extractortorolldown-plugin-dts. After building some packages with Vite 8 in lib mode output.mtsfiles had raw fakejs arrays like[1, () => [...]]instead of actual TypeScript declarations. Downstream packages could not type-check at all.What was happening
I'm not super familiar with the rolldown plugin internals, so it took some digging. I added debug logging to hooks and traced it down to two possible separate "bugs" (once again, I was fixing problem I've faced, not sure if it's generic and it makes sense to push it as fix) that combine together in Vite 8 lib mode:
Array inputs not handled in
buildStartVite 8 passes
options.inputas array (['src/index.ts']) butbuildStartonly handled object inputs ({ index: 'src/index.ts' }). When input is array,inputAliasMapstayed empty so emitted DTS chunks gotname: undefinedinstead of smth likeindex.d.Fixed-string
entryFileNamesmissing.din outputVite 8 lib mode provides
entryFileNamesas function returning fixed string (like'index.mjs') not a template with[name]. TheentryFileNameshook converted.mjsto.mtsbut never inserted.d, producingindex.mtsinstead ofindex.d.mts. ThenrenderChunkdid not recognize it as a DTS file and skipped the fake-js reversal.fix
elsebranch inbuildStartto populateinputAliasMapfor array inputs deriving chunk names from file basenamesfilename_js_to_dts()step inentryFileNameshook — same pattern thatfake-jsplugin already uses in itschunkFileNameshookAll 201 tests pass (195 existing + 6 new ones covering these cases).
Linked Issues
Additional context