JSPM

  • Created
  • Published
  • Downloads 708453
  • Score
    100M100P100Q182828F
  • License MIT

A Vite plugin to polyfill native Node modules for the browser

Package Exports

  • vite-plugin-node-polyfills

Readme

vite-plugin-node-polyfills

A Vite plugin to polyfill native Node modules for the browser

Getting Started

Install the package as a dev dependency.

# npm
npm install --save-dev vite-plugin-node-polyfills

# pnpm
pnpm install --save-dev vite-plugin-node-polyfills

# yarn
yarn add --dev vite-plugin-node-polyfills

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

import { defineConfig } from 'vite'
import { nodePolyfills } from 'vite-plugin-node-polyfills'

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

Attribution

Special thanks to @FbN for putting together this gist.