diff --git a/src/logger/logger.ts b/src/logger/logger.ts index 4ba666f..4a65a80 100644 --- a/src/logger/logger.ts +++ b/src/logger/logger.ts @@ -106,15 +106,15 @@ async function getStaticSourceMaps(): Promise> { ) continue; // make sure .map file exists const fileBuff = await fs.readFile(file + '.map'); - if (URL && (URL.createObjectURL)) { + if (URL && typeof Blob !== 'undefined' && typeof process !== 'object') { // only run this stuff if we are running in a browser window const mappingsWasmBuffer = await fs.readFile( - path.join(__dirname, '../../node_modules/source-map/lib/mappings.wasm'), + path.join(__dirname, '../../node_modules/source-map/lib/mappings.wasm'), ); const mappingsWasmBlob = new Blob([mappingsWasmBuffer], { type: 'application/wasm' }); - // xx eslint-disable-next-line @typescript-eslint/ban-ts-comment - // xx @ts-ignore Typescript is missing this function... Probably because it is static - // xx SourceMapConsumer.initialize({ 'lib/mappings.wasm': URL.createObjectURL(mappingsWasmBlob) }); + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore Typescript is missing this function... Probably because it is static + SourceMapConsumer.initialize({ 'lib/mappings.wasm': URL.createObjectURL(mappingsWasmBlob) }); } const sourceMapConsumer = await new SourceMapConsumer(fileBuff.toString()); sourceMaps.set(file, sourceMapConsumer);