Vite plugin that wraps rollup-plugin-node-externals to automatically externalize Node.js built-in modules and npm dependencies in Vite builds. Version 0.0.1, released in 2021. No active release cadence. The main differentiator is that it fixes Vite's plugin ordering issue by enforcing 'pre' type, allowing rollup-plugin-node-externals to work correctly. However, the author recommends against using it and suggests directly configuring rollup-plugin-node-externals with enforce: 'pre' instead.
npm install vite-plugin-node-externalsVerified import paths — ran on the pinned version, not inferred.
Basic setup to externalize Node builtins and deps in a Vite library build.
Replace with rollup-plugin-node-externals and set enforce: 'pre'.
Use import syntax or switch to a CJS-compatible wrapper.
Use rollup-plugin-node-externals directly for full option support.
Change require() to import() or switch to dynamic import.
Use import nodeExternals from 'vite-plugin-node-externals' (default) or import { nodeExternals } from '...' (named).Use rollup-plugin-node-externals directly or update vite-plugin-node-externals if available.