build: drop vite-plugin-node-polyfills and its elliptic dependency (#59)

The plugin pulled node-stdlib-browser -> crypto-browserify ->
browserify-sign/create-ecdh -> elliptic (GHSA-848j-6mx2-7j84, no
patched release) into the runtime dependency tree.

Nothing in the app imports a Node builtin. In the production build the
plugin only injected shims at four call sites, each already guarded by a
typeof check with a browser fallback:

- @supabase/storage-js toBase64 (Buffer; falls back to btoa, and the app
  does not use Supabase Storage)
- @supabase/realtime-js WebSocketFactory (global; native WebSocket is
  detected first)
- @pezkuwi/x-global (global; globalThis is checked first)
- js-sha3 (process; only used to detect Node)

The crypto, stream and util polyfills were never reached by any module,
so removing the plugin drops 97 packages from the lockfile, including
elliptic, and the feross buffer copy from the bundle.
This commit is contained in:
SatoshiQaziMuhammed authored and GitHub committed 2026-11-15 06:26:08 +04:00
1 parent 75ac84abc9
commit a80c7c30d1
3 files changed
+102 -1106

No files matched your search

+101 -1095
View File
File diff suppressed because it is too large. Load diff
+1 -2
View File
@@ -52,8 +52,7 @@
"react": "^18.3.1",
"react-dom": "^18.3.1",
"tailwind-merge": "^2.5.2",
"tailwindcss-animate": "^1.0.7",
"vite-plugin-node-polyfills": "^0.25.0"
"tailwindcss-animate": "^1.0.7"
},
"devDependencies": {
"@testing-library/jest-dom": "^6.9.1",
-9
View File
@@ -1,6 +1,5 @@
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react-swc';
import { nodePolyfills } from 'vite-plugin-node-polyfills';
import path from 'path';
import fs from 'fs';
@@ -12,14 +11,6 @@ const versionInfo = JSON.parse(
export default defineConfig({
plugins: [
react(),
nodePolyfills({
include: ['buffer', 'crypto', 'stream', 'util'],
globals: {
Buffer: true,
global: true,
process: true,
},
}),
// Copy version.json to dist for update checking
{
name: 'copy-version',