fix(core): update

This commit is contained in:
2020-06-25 23:34:59 +00:00
parent 01cd3fbb0b
commit 9dec755ea5
5 changed files with 33 additions and 65 deletions

View File

@ -6,11 +6,10 @@ import * as plugins from './webrequest.plugins';
export class WebRequest {
private static polyfillsLoaded = false;
public static loadNeededPolyfills() {
if (!this.polyfillsLoaded) {
const smartenv = new plugins.smartenv.Smartenv();
if (!smartenv.isBrowser && !this.polyfillsLoaded) {
this.polyfillsLoaded = true;
// tslint:disable-next-line: no-eval
const loadFetchPolyfill = eval(`globalThis.fetch = require('node-fetch')`);
loadFetchPolyfill();
globalThis.fetch = smartenv.getSafeNodeModule('node-fetch');
}
}

View File

@ -1,3 +1,4 @@
import * as smartdelay from '@pushrocks/smartdelay';
import * as smartenv from '@pushrocks/smartenv';
export { smartdelay };
export { smartdelay, smartenv };