esm import breaks in web worker
See original GitHub issueEthers Version
5.6.esm.min.js
Search Terms
es6 esm import web worker
Describe the Problem
importing ethers in web worker throws exceptions about missing window object
expected behavior: use ethers inside web worker to improve CPU efficiency while rendering UI
Code Snippet
// web_worker.js
import { ethers } from './ethers-5.6.esm.min.js';
Temp work around ?
// ethers-5.6.esm.min.js
var window = self;
Contract ABI
No response
Errors
No response
Environment
No response
Environment (Other)
No response
Issue Analytics
- State:
- Created a year ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Web Workers - How To Import Modules - Stack Overflow
So, my question is, how do we use the new import module syntax with workers? Second question is, what does importScripts import into...
Read more >import - JavaScript - MDN Web Docs - Mozilla
The static import declaration is used to import read-only live bindings which are exported by another module. The imported bindings are ...
Read more >164860 – JS Modules in Workers - WebKit Bugzilla
I am crafting a web workers driven ES8 framework, so module support for workers (including dynamic imports) is one of the key features...
Read more >workers | API Reference | ArcGIS Maps SDK for JavaScript 4.25
ESM : import * as workers from "@arcgis/core/core/workers"; ... This module is a utility framework that simplifies the use of Web Workers in...
Read more >Web workers, React, and TypeScript - LogRocket Blog
Let's break it down a bit. First, we begin by disabling the error that says we've used self incorrectly. Next, we'll import the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This should be fixed in 5.6.7. Please try it out and let me know.
Thanks! 😃
I’ve confirmed this issue. Researching how to fix it now, as the dust files are generated by rollup; there is likely some config to make this play nicely with others.