unplugin-externalize-deps
v0.0.10
Published
externalize dependencies from production build
Downloads
3
Maintainers
Readme
unplugin-externalize-deps
externalize dependencies from production build
📦 Installation
# npm
npm i unplugin-externalize-deps
# pnpm
pnpm i unplugin-externalize-deps
// vite.config.ts
import UnpluginExternalizeDeps from 'unplugin-externalize-deps/vite';
export default defineConfig({
plugins: [UnpluginExternalizeDeps()],
});
// rollup.config.js
import UnpluginExternalizeDeps from 'unplugin-externalize-deps/rollup';
export default {
plugins: [UnpluginExternalizeDeps()],
};
⚙️ Options
export interface Options {
/** any first level field in package.json */
depTypes?: {
/** @default true */
dependencies: boolean;
/** @default false */
devDependencies: boolean;
/** @default true */
optionalDependencies: boolean;
/** @default true */
peerDependencies: boolean;
[key: string]: boolean;
};
/**
* whether externalize node builtin modules like: fs, path
*
* Note: this will also externalize node builtin modules with `node:` protocol, like: node:fs, node:path
*
* @default false
*/
nodeBuiltins?: boolean;
/**
* the path(s) to your package.json, or similar json config file, for example: importmap config
*
* @default path.resolve(process.cwd(), 'package.json')
*/
packagePath?: string | string[];
/**
* specify a list of deps which must bundled, a dependency will not excluded if matched
*
* @example ['axios', /lodash(-es)?/]
* @default []
*/
bundleDeps?: Array<string | RegExp>;
}