A Vite plugin (v0.0.1, stable) that excludes ESM dependencies from Vite's dependency optimization to prevent page reloads caused by 'New dependencies detected'. It scans node_modules and excludes all ESM packages from the pre-bundling process, reducing the likelihood of shared chunk regeneration. Requires Vite >=2.0.0. Differentiator: automates exclusion strategy unlike manual optimizeDeps.exclude configuration.
npm install vite-plugin-optimize-excludeVerified import paths — ran on the pinned version, not inferred.
Basic usage: import and add the plugin to Vite config to automatically exclude ESM dependencies from optimization.
Ensure your project uses ESM (type: 'module' in package.json) and Vite's ESM mode.
Monitor bundle size and request count; consider customizing the exclude list if needed.
Switch to import statement or use dynamic import().
Use import optimizeExclude from 'vite-plugin-optimize-exclude' without destructuring.