Vite Plugin for Node.js Standard Library Browser Polyfills

0.2.1 · active · verified Wed Apr 22

vite-plugin-node-stdlib-browser, currently at version 0.2.1, is a Vite plugin designed to integrate `node-stdlib-browser` into Vite projects. Its primary function is to provide browser polyfills for Node.js built-in modules, enabling web applications to run code that implicitly or explicitly relies on these Node.js APIs within a browser environment. The plugin maintains a relatively slow release cadence, typical for a utility plugin that wraps another library, and its current version is still in an early development stage, as indicated by the author's disclaimer regarding limited testing in complex projects. A key differentiator is its explicit design choice to *not* support `node:` protocol imports and to *only* polyfill dependencies, not direct user code. This intentional limitation sets it apart from alternatives like `vite-plugin-node-polyfills`, which does offer `node:` protocol support. Developers should be aware of these architectural decisions when choosing a polyfill solution.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to configure `vite-plugin-node-stdlib-browser` in your `vite.config.js` to enable Node.js standard library polyfills for your Vite project's browser build. It shows the necessary import and plugin registration.

import { defineConfig } from 'vite'
import nodePolyfills from 'vite-plugin-node-stdlib-browser'

export default defineConfig({
  plugins: [
    nodePolyfills()
  ]
})

view raw JSON →