Summary
In my open-source docgen package I use:
"vite": "8.0.0-beta.8"
"vite-plugin-node-polyfills": "^0.25.0"
I'm seeing different behaviour in whether polyfills are working depending on the build mode
- in the "development mode" build it seems to work fine
- in the production build, I still see
Buffer is not defined warnings
Steps to reproduce:
- clone my repo: https://github.com/mtmacdonald/docgen
- checkout branch
reproduce-vite-plugin-node-polyfills-issues (PR194)
yarn install
yarn dev:docs -> "development mode buid" (working)
yarn build:docs then yarn preview:docs -> "production mode build" (issue)
- open the browser URL and press the
PDF button in the header to see the issue. In dev mode, there is no warning. In prod mode, you can see Buffer is not defined warning
- the package that needs the polyfill is @react-pdf/renderer
