Open GiovaniGuizzoYUB opened 2 months ago
For reference, if I try to use v0.22.0, I get the following error:
TypeError: Cannot read properties of undefined (reading 'Buffer')
at helpers.ts:2:32
This is the culprit in helpers.ts
:
globalThis.Buffer = globalThis.Buffer || __buffer_polyfill;
Build works fine. It only happens in vite dev
.
If I set globals: { Buffer: false }
, thne the same error occurs for global
.
Progress. Changing from plugins: [react(), TanStackRouterVite(), nodePolyfills()],
to plugins: [nodePolyfills(), react(), TanStackRouterVite()],
seems to have fixed the issue on v0.22.0.
Summary
I am trying to use this plugin for polyfilling Node into my vite applciation. It builds my website perfectly, but when used with
vite dev
, I get the following error:this is my Vite config:
This line from
helpers.ts
seems to be the culprit:I am currently using v0.17.0 due to this bug: https://github.com/davidmyersdev/vite-plugin-node-polyfills/issues/81
Any suggestions?