davidmyersdev / vite-plugin-node-polyfills

A Vite plugin to polyfill Node's Core Modules for browser environments.
MIT License
301 stars 22 forks source link

When vite define contains process.env: xx, process polyfill will fail #71

Open winixt opened 8 months ago

winixt commented 8 months ago
import { defineConfig } from 'vite'
import { nodePolyfills } from 'vite-plugin-node-polyfills'

// https://vitejs.dev/config/
export default defineConfig({
  define: {
    "process.env.A": 1,
  },
  plugins: [
     nodePolyfills({
       globals: {
          process: true,
       },
    }),
  ],
})

image

davidmyersdev commented 8 months ago

Hey @winixt. Would you mind adding a reproducible example via Stackblitz or similar?