A Vite plugin to polyfill Node's Core Modules for browser environments.
MIT License
buffer
are exportedPublished by davidmyersdev 9 months ago
Published by davidmyersdev 10 months ago
buffer
and process
) when a trailing slash is used (e.g. import process from 'process/'
)Published by davidmyersdev 10 months ago
buffer
and process
shims so that conflicting install versions are no longer a concern with Yarn v1 (#61).Published by davidmyersdev 11 months ago
main
Published by davidmyersdev 12 months ago
onwarn
handler when availablePublished by davidmyersdev about 1 year ago
onwarn
handler is invoked if it existsenv.command
instead of env.mode
so that alternative modes work properlyPublished by davidmyersdev about 1 year ago
Add support for overriding default polyfills
Published by davidmyersdev about 1 year ago
Add the include
option to only polyfill the specified modules. Thanks @leticiavna for the PR!
Published by davidmyersdev about 1 year ago
Published by davidmyersdev about 1 year ago
v0.11.2
Buffer
, global
, and process
) are properly shimmed in all environments.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
},
}),
],
})
Published by davidmyersdev over 1 year ago
Update usage examples
Published by davidmyersdev over 1 year ago
Specific modules can now be excluded via the new exclude
configuration option.
nodePolyfills({
exclude: ['fs'],
})
Published by davidmyersdev almost 2 years ago
Fix Vite optimization error on esbuild injected shims.
Published by davidmyersdev almost 2 years ago
Add support for Vite v4