vite-plugin-ngmi-polyfill
Vite plugin for polyfilling Node.js built-in globals and modules ⚡️
using node-stdlib-browser
Installing
npm install vite @subframe7536/vite-plugin-ngmi-polyfill
yarn add vite @subframe7536/vite-plugin-ngmi-polyfill
pnpm add vite @subframe7536/vite-plugin-ngmi-polyfill
Usage
import { defineConfig } from 'vite'
import { NgmiPolyfill } from '@subframe7536/vite-plugin-ngmi-polyfill'
export default defineConfig({
plugins: [NgmiPolyfill({
/* options */
})],
})
Options
type GlobalNames = 'process' | 'global' | 'Buffer'
/**
* node polyfill config
*/
export type NgmiPolyfillOptions = {
/**
* global modules, enable all if absent
*/
globals?: Partial<Record<GlobalNames, boolean>>
/**
* polyfill modules, enable all if absent
*/
polyfills?: Partial<Record<PackageNames, boolean>>
}