fix: vite.config default export reachable under includeEntryExports (#282)#285
Merged
BartWaardenburg merged 1 commit intofallow-rs:mainfrom May 5, 2026
Conversation
Fixes fallow-rs#282. Mirrors the vitest fix in fallow-rs#271. With --include-entry-exports, fallow flagged vite.config.* default exports as unused even though Vite's CLI consumes that default export. The vite plugin now contributes used_exports for vite.config.{ts,js,mts,mjs} (default), matching the shape already used for vitest.config.* and vitest.workspace.*. Adds a regression fixture (vite-include-entry-exports-workspace) and an integration test that pins the new behavior. Existing entry-export validation tests continue to ensure --include-entry-exports still flags truly-unused named exports on non-config entries.
Collaborator
|
Merged in 868d44d. Thanks @ChrisJr404. |
Collaborator
|
Released in v2.65.0. Thanks @ChrisJr404. |
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.
Closes #282.
Problem
vite.config.{ts,js,mts,mjs}exports adefineConfig({...})value asdefault, and Vite's CLI consumes that default export — that is the entry. WithincludeEntryExports: true, fallow flags it as unused:OP repro on #282: same shape as #271 (vitest), now for plain Vite configs.
Fix
Same approach as #271 (commit ce5580c): the vite plugin contributes
used_exportsforvite.config.{ts,js,mts,mjs}(default), so under--include-entry-exportsthe framework-supplied entry export is recognised as reachable.Smallest viable diff — one
used_exports: [(...)]line onVitePluginplus aCONFIG_EXPORTSconst, mirroringVitestPlugin.Before / after (on the OP's repro)
Before:
vite.config.mtsdefaultreported underunused-exports.After:
vite.config.mtsdefaultno longer reported.Regression pin
Existing tests in
crates/core/tests/integration_test/entry_export_validation.rsalready cover the case where--include-entry-exportsshould flag genuinely-unused named exports on non-config entries (entry_exports_detected_when_include_entry_exports_enabled,entry_exports_detected_via_config_file_include_entry_exports). They continue to pass — the new used_exports rule is glob-scoped tovite.config.{ts,js,mts,mjs}only, so non-config entry files are unaffected.Test coverage
New integration test
vite_config_default_export_is_framework_used_with_include_entry_exports+ fixturetests/fixtures/vite-include-entry-exports-workspace/(workspace shape matches the vitest sibling fixture).