You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey guys. I'm facing a problem with Web3.js library
[1] 💿 Rebuilding...
[1] 💿 Rebuilt in 530ms
[1] ReferenceError: window is not defined
[1] at Object.<anonymous> (E:\Projects\my-remix-app\node_modules\web3\dist\web3.min.js:1:190)
[1] at Module._compile (internal/modules/cjs/loader.js:1063:30)
[1] at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
[1] at Module.load (internal/modules/cjs/loader.js:928:32)
[1] at Function.Module._load (internal/modules/cjs/loader.js:769:14)
[1] at Module.require (internal/modules/cjs/loader.js:952:19)
[1] at require (internal/modules/cjs/helpers.js:88:18)
[1] at Object.<anonymous> (E:\Projects\my-remix-app\build\index.js:116:34)
[1] at Module._compile (internal/modules/cjs/loader.js:1063:30)
[1] at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
[1] at Module.load (internal/modules/cjs/loader.js:928:32)
[1] at Function.Module._load (internal/modules/cjs/loader.js:769:14)
[1] at Module.require (internal/modules/cjs/loader.js:952:19)
[1] at require (internal/modules/cjs/helpers.js:88:18)
[1] at E:\Projects\my-remix-app\node_modules\@remix-run\serve\index.js:39:17
[1] at Layer.handle [as handle_request] (E:\Projects\my-remix-app\node_modules\express\lib\router\layer.js:95:5)
I fixed this problem in my other project running on vite using following scripts in index.html
//index.html
<!-- web3 setup (for Vitejs react project only) -->
<script>window.global = window;</script>
<script type="module">
import process from "process";
import { Buffer } from "buffer";
import EventEmitter from "events";
window.Buffer = Buffer;
window.process = process;
window.EventEmitter = EventEmitter;
</script>
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hey guys. I'm facing a problem with Web3.js library
I fixed this problem in my other project running on vite using following scripts in
index.html
I need to do something similar in remix. But have no idea how
Beta Was this translation helpful? Give feedback.
All reactions