vite-plugin-commonjs-externals

JSON →
library 0.1.4 ·javascript
verified Apr 27, 2026

Vite plugin that prevents bundling of specified ESM imports and replaces them with CommonJS require() calls at runtime. Version 0.1.4, stable with infrequent releases. Designed for Electron renderer processes and Node.js environments where CommonJS modules (like 'electron', 'fs', 'path') must be imported via require() rather than bundled. Key differentiator: handles named, default, and namespace imports correctly by generating interop code similar to Rollup's CJS output. Unlike @vitejs/plugin-commonjs which focuses on converting CJS to ESM, this plugin does the reverse — converting ESM imports into CJS requires for a list of externals. Supports regex patterns for dynamic package matching.

total hits 10
actors 3 distinct systems
last hit 5d ago human
GPTBot
5
Search engines
1
Humans
2

top countries 🇺🇸 United States · 🇨🇦 Canada · 🇮🇳 India · 🇫🇷 France