diff --git a/src/main.jsx b/src/main.jsx index 0b1c020..74daea9 100644 --- a/src/main.jsx +++ b/src/main.jsx @@ -3,6 +3,11 @@ import ReactDOM from "react-dom/client"; import App from "./App"; // Ensure this is the correct path import "./index.css"; import "@near-wallet-selector/modal-ui/styles.css"; +import { Buffer } from "buffer"; +import crypto from "crypto-browserify"; + +window.Buffer = Buffer; +window.crypto = crypto; ReactDOM.createRoot(document.getElementById("root")).render( diff --git a/vite.config.js b/vite.config.js index f38bde7..1e3caac 100644 --- a/vite.config.js +++ b/vite.config.js @@ -11,11 +11,12 @@ export default defineConfig({ ], resolve: { alias: { + crypto: "crypto-browserify", // Alias crypto to the browser-compatible polyfill buffer: "buffer", // Alias buffer to the browser-compatible polyfill }, }, optimizeDeps: { - include: ["buffer"], // Pre-bundle buffer + include: ["crypto-browserify", "buffer"], // Pre-bundle crypto-browserify }, server: { proxy: { @@ -27,8 +28,11 @@ export default defineConfig({ }, }, build: { - outDir: "dist", // Azure expects this folder for the build + rollupOptions: { + input: "./src/main.jsx", + }, + outDir: "dist", emptyOutDir: true, - sourcemap: false, // Disable source maps for production + sourcemap: false, }, });