fix node-check by adding checks for Blob and typeof process
This commit is contained in:
parent
97b3d3d4e1
commit
307caecae8
@ -106,15 +106,15 @@ async function getStaticSourceMaps(): Promise<Map<string, SourceMapConsumer>> {
|
|||||||
)
|
)
|
||||||
continue; // make sure .map file exists
|
continue; // make sure .map file exists
|
||||||
const fileBuff = await fs.readFile(file + '.map');
|
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
|
// only run this stuff if we are running in a browser window
|
||||||
const mappingsWasmBuffer = await fs.readFile(
|
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' });
|
const mappingsWasmBlob = new Blob([mappingsWasmBuffer], { type: 'application/wasm' });
|
||||||
// xx eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// xx @ts-ignore Typescript is missing this function... Probably because it is static
|
// @ts-ignore Typescript is missing this function... Probably because it is static
|
||||||
// xx SourceMapConsumer.initialize({ 'lib/mappings.wasm': URL.createObjectURL(mappingsWasmBlob) });
|
SourceMapConsumer.initialize({ 'lib/mappings.wasm': URL.createObjectURL(mappingsWasmBlob) });
|
||||||
}
|
}
|
||||||
const sourceMapConsumer = await new SourceMapConsumer(fileBuff.toString());
|
const sourceMapConsumer = await new SourceMapConsumer(fileBuff.toString());
|
||||||
sourceMaps.set(file, sourceMapConsumer);
|
sourceMaps.set(file, sourceMapConsumer);
|
||||||
|
Loading…
Reference in New Issue
Block a user