vite-plugin-node-polyfills

A Vite plugin to polyfill Node's Core Modules for browser environments.

MIT License

Downloads
1.5M
Stars
224
Committers
11
vite-plugin-node-polyfills - v0.21.0 Latest Release

Published by davidmyersdev 9 months ago

  • fix: Make sure all modules under buffer are exported
vite-plugin-node-polyfills - v0.20.0

Published by davidmyersdev 9 months ago

  • Fix global polyfill import error (#74)
vite-plugin-node-polyfills - v0.19.0

Published by davidmyersdev 10 months ago

  • Add end-to-end tests with Playwright
  • Add unit/integration tests with Vitest
  • Fix imports for global polyfills (buffer and process) when a trailing slash is used (e.g. import process from 'process/')
  • Replace the IIFE banner with import statements (avoids name conflicts)
vite-plugin-node-polyfills - v0.18.0

Published by davidmyersdev 10 months ago

  • Improve the shim process so that polyfilled globals are not statically replaced in libraries (#47).
  • Internalize buffer and process shims so that conflicting install versions are no longer a concern with Yarn v1 (#61).
vite-plugin-node-polyfills - v0.17.0

Published by davidmyersdev 11 months ago

  • Add support for Vite v5 (and make it the default)
  • Configure CI to run checks on PRs and commits to main
vite-plugin-node-polyfills - v0.16.0

Published by davidmyersdev 12 months ago

  • Reduce the package size by removing unnecessary files
  • Correctly call the preconfigured onwarn handler when available
vite-plugin-node-polyfills - v0.15.0

Published by davidmyersdev about 1 year ago

  • Ensure the predefined onwarn handler is invoked if it exists
  • Use env.command instead of env.mode so that alternative modes work properly
vite-plugin-node-polyfills - v0.14.0

Published by davidmyersdev about 1 year ago

Add support for overriding default polyfills

vite-plugin-node-polyfills - v0.12.0

Published by davidmyersdev about 1 year ago

Add the include option to only polyfill the specified modules. Thanks @leticiavna for the PR!

vite-plugin-node-polyfills - v0.11.3

Published by davidmyersdev about 1 year ago

  • Add a workaround for a Yarn v1 bug
vite-plugin-node-polyfills - v0.11.2

Published by davidmyersdev about 1 year ago

v0.11.2

  • Make sure globals (Buffer, global, and process) are properly shimmed in all environments.
  • Replace upstream global shims with newer dependencies
vite-plugin-node-polyfills - v0.9.0

Published by davidmyersdev over 1 year ago

Allow globals (Buffer, global, and process) to be disabled for build, dev, or both.

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

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    nodePolyfills({
      // Whether to polyfill specific globals.
      globals: {
        Buffer: 'dev', // defaults to true
        global: false, // defaults to true
        process: 'build', // defaults to true
      },
    }),
  ],
})
vite-plugin-node-polyfills - v0.8.2

Published by davidmyersdev over 1 year ago

Update usage examples

vite-plugin-node-polyfills - v0.8.1

Published by davidmyersdev over 1 year ago

Features

Specific modules can now be excluded via the new exclude configuration option.

nodePolyfills({
  exclude: ['fs'],
})
vite-plugin-node-polyfills - v0.7.0

Published by davidmyersdev almost 2 years ago

Fix Vite optimization error on esbuild injected shims.

vite-plugin-node-polyfills - v0.6.0

Published by davidmyersdev almost 2 years ago

Add support for Vite v4

Package Rankings
Top 2.39% on Npmjs.org
Top 6.73% on Proxy.golang.org
Badges
Extracted from project README
Sponsor me Donate