Files
5chan/src/polyfills.js
T
Tommaso CasaburiandGitHub 5dc5408a15 fix(codebase audit): preserve cleanup without regressions
Fix codebase audit regressions while preserving UI/UX behavior and adding review-driven hardening.
2026-04-24 15:48:07 +07:00

22 lines
643 B
JavaScript

// Polyfills for Node.js built-ins
import { Buffer } from 'buffer';
import process from 'process';
import 'isomorphic-fetch';
window.Buffer = Buffer;
window.process = process;
window.global = window;
// For ethers.js
window.process.version = ''; // Fake Node.js version
window.process.env = window.process.env || {};
// Add any missing fetch polyfill
if (!window.fetch) {
console.warn('Fetch API is not available, using polyfill');
}
if (typeof window.crypto === 'undefined' || typeof window.crypto.getRandomValues !== 'function') {
throw new Error('crypto.getRandomValues is required for secure account and signature operations.');
}