vite-plugin-react-swc icon indicating copy to clipboard operation
vite-plugin-react-swc copied to clipboard

fix: React in WebWorker window is undefined

Open connorgmeehan opened this issue 1 year ago • 2 comments

Previously the HMR code would use window as the global scope which is undefined in webworkers.

This change uses some code lifted from @vitejs/plugin-react to check if the context is in a webworker before doing trying to use window.

HMR is not currently possible in vite (https://github.com/vitejs/vite-plugin-react/issues/152) so nothing happens when the worker file is edited.

connorgmeehan avatar Jun 25 '24 09:06 connorgmeehan