Skip to content

Honor Vite server and optimizer configuration - #150

Merged
raphamorim merged 1 commit into
mainfrom
fix/vite-config-adoption
Sep 26, 2026
Merged

raphamorim merged 1 commit into
mainfrom
fix/vite-config-adoption

Conversation

@raphamorim

Copy link
Copy Markdown
Collaborator

No description provided.

@raphamorim
raphamorim force-pushed the fix/vite-config-adoption branch from 719fd28 to 6247a9c Compare September 26, 2026 09:28
@raphamorim
raphamorim requested a review from a team as a code owner September 26, 2026 09:28
@raphamorim

Copy link
Copy Markdown
Collaborator Author

Reviewed against the Vite source, rebased onto main (post 0.2.8), and fixed the findings in place. All fixes are amended into the original commit.

Root cause behind most findings: the extractor reads Vite's resolved config, where defaults are indistinguishable from user intent (resolveConfig fills optimizeDeps.noDiscovery: false, brace-form server.fs.deny, empty warmup arrays). Adoption is now gated on the raw user config where that matters.

Findings fixed:

  1. noDiscovery default adopted as explicit. Every app without optimizeDeps would cross noDiscovery: false as a user setting. Now only crosses when the raw config sets a boolean.
  2. Empty warmup arrays emitted. Vite's resolved default is { clientFiles: [], ssrFiles: [] }; we now emit only non-empty filtered lists.
  3. warnUnsupported regressions. The narrowed warnings for optimizeDeps.esbuildOptions.plugins, rolldownOptions.plugins, and the rollupOptions spelling were dropped; restored.
  4. warmup_paths matching. Patterns like ./src/*.tsx never matched (no ./ normalization), roots with glob metacharacters broke matching, and ! exclusions compared against absolute paths. Now: ./ stripped, root escaped with glob::Pattern::escape, exclusions matched root-relative (Vite's warmup.ts semantics).
  5. fs.deny brace patterns. The glob crate has no brace expansion, so Vite's default-shaped **/{.git,node_modules}/** style deny entries silently matched nothing. Added recursive {a,b} expansion.
  6. jsx translation. rolldownOptions.transform.jsx can be an object; esbuild's jsx option is string-only, so an object crossed as garbage. Only strings cross now (define/target/keepNames/drop unchanged).
  7. noDiscovery missing from the optimizer cache key. Toggling it changed the run but not lockfile_hash, so a stale bundle survived the toggle. Shared effective_auto_discover now feeds both the run and the hash.
  8. SSR warmup transform loop. Transforming ssrFiles inline duplicated work and ran before the hook plan existed; replaced with priming the SSR plugin host's hook plan when ssrFiles are present, so warmup goes through the gated path.

Also: the "settings survive actual config loading" test invoked vite-extract.mjs as a CLI, which no longer exists after the engine-job move; rewired to the extraction wrapper the rest of the suite uses. Added regression tests for 1, 4, 5, 6 (plus a real-vite test proving resolved defaults do not cross), and gave the e2e harness rmSync retries to fix an ENOTEMPTY cleanup race in the new vite-config-adoption e2e.

Verified by exit codes: cargo test -p oj_server -p oj_config -p oj, node --test e2e/unit (265 pass), node e2e/run.mjs, node e2e/vite-config-adoption.mjs x3.

@raphamorim
raphamorim merged commit 9b52085 into main Sep 26, 2026
6 checks passed
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.

1 participant