From 5d1985655da4a3d804102271d1e1859754420016 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Tue, 27 Aug 2024 10:29:31 -0700 Subject: [PATCH] Fix environment detection in web worker --- src/lexer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lexer.js b/src/lexer.js index 2b3ea42..e2f6952 100755 --- a/src/lexer.js +++ b/src/lexer.js @@ -92,7 +92,7 @@ function copyLE (src, outBuf16) { function getWasmBytes() { const binary = 'WASM_BINARY'; // This string will be replaced by build.js. - if (typeof window !== 'undefined' && typeof atob === 'function') + if ((typeof window !== 'undefined' || typeof self !== 'undefined') && typeof atob === 'function') return Uint8Array.from(atob(binary), x => x.charCodeAt(0)); return Buffer.from(binary, 'base64'); }