diff --git a/discord/vite.config.ts b/discord/vite.config.ts index eb48216..bc50707 100644 --- a/discord/vite.config.ts +++ b/discord/vite.config.ts @@ -1,7 +1,14 @@ +import { webcrypto } from 'node:crypto' import { defineConfig } from 'vite' import react from '@vitejs/plugin-react' import path from "path"; +// Ensure a Web Crypto implementation with getRandomValues exists for Vite's build pipeline +if (!globalThis.crypto?.getRandomValues) { + // @ts-expect-error - assigning Web Crypto to the global crypto reference for Node builds + globalThis.crypto = webcrypto as unknown as Crypto +} + // https://vitejs.dev/config/ export default defineConfig({ base: './',