Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vite-plugin-externalize-deps

Package Overview
Dependencies
Maintainers
2
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vite-plugin-externalize-deps

A configurable Vite plugin to help externalize your dependencies (includes subpaths)

  • 0.8.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
16K
decreased by-23.03%
Maintainers
2
Weekly downloads
 
Created
Source

vite-plugin-externalize-deps

A configurable Vite plugin to help externalize your dependencies (including subpaths).

Getting Started

Install the package as a dev dependency.

# npm
npm install --save-dev vite-plugin-externalize-deps

# pnpm
pnpm install --save-dev vite-plugin-externalize-deps

# yarn
yarn add --dev vite-plugin-externalize-deps

Add the plugin to your vite.config.ts file.

import { defineConfig } from 'vite'
import { externalizeDeps } from 'vite-plugin-externalize-deps'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    externalizeDeps(),
  ],
})

Configuration

Pass an object to externalizeDeps to override the default configuration.

// These are the default values.
externalizeDeps({
  deps: true,
  devDeps: false,
  except: [],
  nodeBuiltins: true,
  optionalDeps: true,
  peerDeps: true,
  useFile: join(process.cwd(), 'package.json'),
})

To include specific dependencies in your bundle, you can add exceptions with the except option.

externalizeDeps({
  except: [
    // Match exact values with strings.
    '@some/obscure/dependency',
    // Or match patterns with regular expressions.
    /^@some\/obscure(?:\/.+)?$/,
  ],
})

Keywords

FAQs

Package last updated on 03 Dec 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc