Closed joyfuI closed 1 year ago
I'll have to dig into this more, but I'm thinking the react
plugin must be injecting something into the browser that is relying on a certain API to not be polyfilled.
Having the same issue here, would love to help out if possible.
Here is another repro not using the react plugin and excluding every option possible. It is still not working: https://codesandbox.io/p/sandbox/optimistic-panini-95xb2d
I was able to determine that the process
shim is what causes the dev tools to not work. My best guess is that the plugin relies on overriding process
itself in dev. I need to think through how I want the interface to work, but I'll likely expose a way to disable the shims for process
, global
, and Buffer
for either dev or build.
This has been fixed in v0.9.0
. For your specific issue, you'll want to do something like this.
import { defineConfig } from 'vite'
import { nodePolyfills } from 'vite-plugin-node-polyfills'
export default defineConfig({
plugins: [
nodePolyfills({
globals: {
process: 'build',
},
}),
],
})
codesandbox link: https://codesandbox.io/p/sandbox/vite-plugin-node-polyfills-92mi3n?file=%2Fvite.config.ts
The ReactQueryDevtools component doesn't show up in the bottom left corner of the preview, but if I comment out nodePolyfills() in vite.config.ts, it shows up again.