grikomsn / vite-plugin-ngmi-polyfill

Vite plugin for polyfilling Node.js built-in globals and modules ⚡️

Home Page:https://www.npmjs.com/package/vite-plugin-ngmi-polyfill

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

vite-plugin-ngmi-polyfill

Vite plugin for polyfilling Node.js built-in globals and modules ⚡️

npm/v npm/dt stars


Table of contents


Reason

Some modules such as events or process requires polyfilling since Vite does not handle it by default (here's a search for vite browser-external errors), whereas several packages, especially web3 related ones, use these packages in order to work.

This package wraps other polyfill packages and exports a Vite plugin so you can easily import inside your vite.config.{js,ts}.

Installing

# using npm
npm install vite vite-plugin-ngmi-polyfill

# using yarn
yarn add vite vite-plugin-ngmi-polyfill

# using pnpm
pnpm add vite vite-plugin-ngmi-polyfill

Usage

import { defineConfig } from "vite";
import { NgmiPolyfill } from "vite-plugin-ngmi-polyfill";

export default defineConfig({
  plugins: [NgmiPolyfill()],
});

Examples

Included packages

License

MIT License, Copyright (c) 2022 Griko Nibras

About

Vite plugin for polyfilling Node.js built-in globals and modules ⚡️

https://www.npmjs.com/package/vite-plugin-ngmi-polyfill

License:MIT License


Languages

Language:TypeScript 63.9%Language:JavaScript 34.2%Language:Shell 1.9%