magic-admin-js
magic-admin-js copied to clipboard
Fails to build for web worker environment
✅ Prerequisites
- [x] Did you perform a cursory search of open issues? Is this bug already reported elsewhere?
- [x] Are you running the latest SDK version?
- [x] Are you reporting to the correct repository (
@magic-sdk/admin)?
🐛 Description
Since version 1.4.1 as a result of https://github.com/magiclabs/magic-admin-js/pull/88 fails to build in web workers due to https://git.coolaj86.com/coolaj86/atob.js/issues/5 .
Fails with:
ReferenceError: window is not defined
at ../../node_modules/.pnpm/[email protected]/node_modules/atob/browser-atob.js (/Users/vsantos/work/pl/gh/nftstorage/nftstorage.link/packages/api/dist/worker.mjs:2363:8)
at __require (/Users/vsantos/work/pl/gh/nftstorage/nftstorage.link/packages/api/dist/worker.mjs:8:50)
at /Users/vsantos/work/pl/gh/nftstorage/nftstorage.link/packages/api/dist/worker.mjs:5122:27
🧩 Steps to Reproduce
- Install in a web worker project
- Build using ESM (or any other)
🤔 Expected behavior
ESM Build works
😮 Actual behavior
ESM build fails
💻 Code Sample
[If possible, please provide a code repository, gist, code snippet or sample files to reproduce the issue.]
🌎 Environment
| Software | Version(s) |
|---|---|
@magic-sdk/admin |
1.4.1 |
| Node | 16.3.0 |
yarn |
|
| Operating System |