For Vite, you will have to define global.window, and this has to be defined before importing Hydra. You can do this by adding a define in the Vite config file:
import react from '@vitejs/plugin-react'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
define: {
global: {
window: {}
},
}
})