-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
fixed/completeThis Bug is fixed or Enhancement is complete and published.This Bug is fixed or Enhancement is complete and published.v5Issues regarding legacy-v5Issues regarding legacy-v5
Description
Ethers Version
5.5.1
Search Terms
window, service worker, globalThis
Describe the Problem
When importing Ether's (ethers.esm.js) on environment (eg, service worker) that has not defined window, importing fails. This is because line 4864 is
var __awaiter = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {I believe these checks should check typeof window !== 'undefined' instead of for window. Other alternative would be to to use globalThis and not window.
Code Snippet
import { ethers } from 'ethers.esm.js'Contract ABI
No response
Errors
Uncaught ReferenceError: window is not defined
ethers.esm.js:4864 (anonymous function)
var __awaiter = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {Environment
Browser (Chrome, Safari, etc)
Environment (Other)
No response
Metadata
Metadata
Assignees
Labels
fixed/completeThis Bug is fixed or Enhancement is complete and published.This Bug is fixed or Enhancement is complete and published.v5Issues regarding legacy-v5Issues regarding legacy-v5