fix: buffer polyfill

This commit is contained in:
Danish Arora 2025-09-18 10:15:06 +05:30
parent 5ea4d7343f
commit c91164dbde
No known key found for this signature in database
GPG Key ID: 1C6EF37CDAE1426E
4 changed files with 12 additions and 0 deletions

1
package-lock.json generated
View File

@ -44,6 +44,7 @@
"@reown/appkit-wallet-button": "^1.7.17",
"@tanstack/react-query": "^5.84.1",
"@waku/sdk": "^0.0.35-67a7287.0",
"buffer": "^6.0.3",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"cmdk": "^1.0.0",

View File

@ -51,6 +51,7 @@
"@reown/appkit-wallet-button": "^1.7.17",
"@tanstack/react-query": "^5.84.1",
"@waku/sdk": "^0.0.35-67a7287.0",
"buffer": "^6.0.3",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"cmdk": "^1.0.0",

View File

@ -1,5 +1,11 @@
import { createRoot } from 'react-dom/client';
import App from './App.tsx';
import './index.css';
import { Buffer } from 'buffer';
// Ensure Buffer is available in the browser (needed by some wallet libs)
if (!(window as Window & typeof globalThis).Buffer) {
(window as Window & typeof globalThis).Buffer = Buffer;
}
createRoot(document.getElementById('root')!).render(<App />);

View File

@ -12,8 +12,12 @@ export default defineConfig(() => ({
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
buffer: 'buffer',
},
},
optimizeDeps: {
include: ['buffer'],
},
build: {
target: 'es2022',
},