https://github.com/litingyes/unplugin-external
External dependencies when building
https://github.com/litingyes/unplugin-external
build esbuild external farm rollup rspack vite webpack
Last synced: 3 months ago
JSON representation
External dependencies when building
- Host: GitHub
- URL: https://github.com/litingyes/unplugin-external
- Owner: litingyes
- License: mit
- Created: 2025-01-16T15:37:50.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2025-09-22T10:59:27.000Z (4 months ago)
- Last Synced: 2025-09-22T12:19:19.875Z (4 months ago)
- Topics: build, esbuild, external, farm, rollup, rspack, vite, webpack
- Language: TypeScript
- Homepage:
- Size: 499 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# unplugin-external
External dependencies when building
## Installation
```bash
pnpm add unplugin-external
```
## Usage
> [!TIP]
> Thanks to [unplugin](https://unplugin.unjs.io/), it can be used in multiple build packagers, e.g. vite/rollup/webpack/esbuild/rspack/rolldown
```ts
import External from 'unplugin-external/vite'
import { defineConfig } from 'vite'
export default defineConfig({
plugins: [External(options)]
})
```
## Options
```ts
export interface Options {
/**
* exclude node builtin modules, e.g. node:os
*
* default: true
*/
nodeBuiltins?: boolean
/**
* current working directory to get package.json data
*
* default: process.cwd()
*/
cwd?: string
/**
* exclude dependencies
*
* default: true
*/
deps?: boolean
/**
* exclude devDependencies
*
* default: false
*/
devDeps?: boolean
/**
* exclude peerDependencies
*
* default: true
*/
peerDeps?: boolean
/**
* exclude peerDependencies
*
* default: true
*/
optDeps?: boolean
/**
* Customizing additional exclusion logic
*/
custom?: (string | RegExp)[] | string | RegExp | ((id: string) => boolean)
}
```