
Research
2025 Report: Destructive Malware in Open Source Packages
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.
vite-plugin-external
Advanced tools
Excludes specified module dependencies from runtime code and built bundles.
Excludes specified module dependencies from runtime code and built bundles. Vite >= 3.1
For detailed usage instructions and API references, please visit the official documentation:
Build iife format bundle
import { defineConfig } from 'vite';
import pluginExternal from 'vite-plugin-external';
export default defineConfig({
plugins: [
pluginExternal({
externals: {
jquery: '$',
vue: 'Vue',
react: 'React',
'react-dom/client': 'ReactDOM'
}
})
],
build: {
rollupOptions: {
output: {
format: 'iife',
},
},
}
});
Dynamic set externals
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import pluginExternal from 'vite-plugin-external';
export default defineConfig({
plugins: [
react({
jsxRuntime: 'classic',
}),
pluginExternal({
externals(libName) {
if (libName === 'react') {
return 'React';
}
if (libName === 'react-dom/client') {
return 'ReactDOM';
}
}
})
],
build: {
rollupOptions: {
output: {
format: 'iife',
},
},
}
});
Build esm format bundle
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import pluginExternal from 'vite-plugin-external';
export default defineConfig({
plugins: [
react({
jsxRuntime: 'classic',
}),
pluginExternal({
externals: {
react: 'https://esm.sh/react@18.3.1',
'react-dom/client': 'https://esm.sh/react-dom@18.3.1'
}
})
]
});
6.2.0
6.1.0
rollback parameter to revert to previous implementationlogLevel parameter to control logging level (values: "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR" | "FATAL" | "OFF")externals as a function6.0.0
externalGlobals parameter to fix issue rollup#31884.3.1
externalizeDeps configuration supports regex patterns4.3.0
mode: false logic replaced with interop: 'auto'nodeBuiltins and externalizeDeps configurations for Node module bundlingexternals./node_modules/.vite/deps folderWe welcome contributions from the community! If you find a bug or want to suggest an improvement, feel free to open an issue or submit a pull request.
This project is licensed under the MIT License.
FAQs
Excludes specified module dependencies from runtime code and built bundles.
We found that vite-plugin-external demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.

Security News
Socket CTO Ahmad Nassri shares practical AI coding techniques, tools, and team workflows, plus what still feels noisy and why shipping remains human-led.

Research
/Security News
A five-month operation turned 27 npm packages into durable hosting for browser-run lures that mimic document-sharing portals and Microsoft sign-in, targeting 25 organizations across manufacturing, industrial automation, plastics, and healthcare for credential theft.