vite-plugin-node-polyfills
vite-plugin-node-polyfills copied to clipboard
Globals are always defined
Globals are always defined in the global scope regardless of configuration.
Here is my config:
import { defineConfig } from 'vite'
import { nodePolyfills } from 'vite-plugin-node-polyfills'
export default defineConfig({
plugins: [
nodePolyfills({
include: ['buffer'],
globals: {
Buffer: true,
global: false,
process: false
}
})
],
})
Expected behavior:
Buffer is defined in the global scope, but global and process are not defined.
Actual behavior:
All globals (Buffer, global and process) are defined.
Some libraries check if process is defined to determine whether the code is running in a Node.js environment or a browser. Currently, this leads to incorrect conclusions and, consequently, errors.