Skip to content

fix(rolldown): keep filtered-out importers from hiding modules in the module graph - #610

Merged
webfansplz merged 1 commit into
mainfrom
fix/rolldown-module-graph-filtered-roots
Oct 11, 2026
Merged

webfansplz merged 1 commit into
mainfrom
fix/rolldown-module-graph-filtered-roots

Conversation

@IWANABETHATGUY

@IWANABETHATGUY IWANABETHATGUY commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator

The Rolldown module graph picked its roots with importers.length === 0. That checks importers across the whole build, but the graph only gets the modules left after the file-type and package filters. A module whose importers were all filtered out was neither a root nor anyone's child, so it disappeared. When no remaining module had zero importers, the graph was empty.

Roots are now the modules with no importer left in the filtered list, falling back to all modules when every one has an importer. This is the rule the Vite module graph already uses (packages/vite/src/app/components/modules/Graph.vue). The unfiltered graph is unchanged.

Screenshots

These screenshots show Rolldown DevTools inspecting its own frontend: the client build of the Nuxt app in packages/rolldown (entry nuxt/dist/app/entry.js). pnpm build in this repo builds it with Rolldown and records the session in packages/rolldown/node_modules/.rolldown/. "Before" is main at 89a7090, "after" is this PR.

To reproduce: run pnpm build, then pnpm -C packages/rolldown run dev, open the session for nuxt/dist/app/entry.js, switch Modules to Graph, and apply the filter. The dev server currently rejects the client with "Not authorized by the devframe server" despite clientAuth: false in its Nuxt config, so I started it with VITE_DEVTOOLS_DISABLE_CLIENT_AUTH=true.

CSS filter: empty graph before, 4 CSS modules after.

CSS filter, before and after

Package filter (floating-vue): empty graph before, both modules after.

floating-vue package filter, before and after

Vue filter: before, app.vue and the modules reachable only through it are missing. The lazy-loaded pages still show because they have no static importer. After, app.vue is a root.

Vue filter, before and after

@pkg-pr-new

pkg-pr-new Bot commented Oct 10, 2026

Copy link
Copy Markdown

Open in StackBlitz

@vitejs/devtools

npm i https://pkg.pr.new/@vitejs/devtools@610

@vitejs/devtools-kit

npm i https://pkg.pr.new/@vitejs/devtools-kit@610

@vitejs/devtools-oxc

npm i https://pkg.pr.new/@vitejs/devtools-oxc@610

@vitejs/devtools-rolldown

npm i https://pkg.pr.new/@vitejs/devtools-rolldown@610

@vitejs/devtools-vite

npm i https://pkg.pr.new/@vitejs/devtools-vite@610

@vitejs/devtools-vitest

npm i https://pkg.pr.new/@vitejs/devtools-vitest@610

commit: b78ee3c

@IWANABETHATGUY
IWANABETHATGUY marked this pull request as draft October 10, 2026 14:29
@IWANABETHATGUY
IWANABETHATGUY marked this pull request as ready for review October 10, 2026 15:57
@webfansplz
webfansplz merged commit 2579c20 into main Oct 11, 2026
10 checks passed
@webfansplz
webfansplz deleted the fix/rolldown-module-graph-filtered-roots branch October 11, 2026 12:52
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.

2 participants