fix: alias crypto-browserify to native Web Crypto shim (inherits error)

This commit is contained in:
2026-02-22 19:37:19 +03:00
parent ddcf3eca23
commit e2cfa136f9
2 changed files with 13 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
// Minimal crypto shim that delegates to the browser's native Web Crypto API
// Prevents crypto-browserify (and its inherits dependency) from being bundled
export default globalThis.crypto;
export const webcrypto = globalThis.crypto;
export const randomBytes = (size: number): Uint8Array => {
const bytes = new Uint8Array(size);
globalThis.crypto.getRandomValues(bytes);
return bytes;
};
export const createHash = undefined;
export const createHmac = undefined;
+2
View File
@@ -75,6 +75,8 @@ export default defineConfig(() => ({
'vite-plugin-node-polyfills/shims/buffer': path.resolve(__dirname, './src/polyfills/buffer-shim.ts'),
'vite-plugin-node-polyfills/shims/global': path.resolve(__dirname, './src/polyfills/global-shim.ts'),
'vite-plugin-node-polyfills/shims/process': path.resolve(__dirname, './src/polyfills/process-shim.ts'),
// Prevent crypto-browserify chain (inherits error) - use native Web Crypto API
'crypto-browserify': path.resolve(__dirname, './src/polyfills/crypto-shim.ts'),
},
dedupe: ['react', 'lucide-react', 'sonner', '@pezkuwi/util-crypto', '@pezkuwi/util', '@pezkuwi/api', '@pezkuwi/extension-dapp', '@pezkuwi/keyring'],
},