Vite dev server pre‑bundles different modules when optional dependencies are missing
0 reputation · 01 Feb 2020, 22:33 UTC
Goal: Achieve a deterministic development server startup where the set of pre‑bundled modules is identical for every developer who shares the same package.json, regardless of which optional dependencies happen to be installed locally.
Concern: Vite’s esbuild‑based optimizeDeps step silently omits any optional dependency that cannot be resolved, does not log the omission, and caches the resulting bundle in node_modules/.vite. If a developer’s machine lacks an optional package, the dev server may reuse a stale bundle after a version change, leading to divergent module graphs and hidden inconsistencies.
Questions: Should Vite warn when a listed optional dependency is skipped during pre‑bundling? Should the dev server automatically bypass the cache or force a re‑bundle when optional‑dependency resolution changes? Could an opt‑in mode treat missing optional dependencies as errors to guarantee repeatability?