davidmyersdev/vite-plugin-node-polyfills

Globals are always defined

Ilyat1337 opened this issue · 1 comments

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.