1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/src/main/fetch/fetch-impl.injectable.ts
Sebastian Malton a9134c30c3 Upgrade to latest node-fetch
- Introduce injection tokens for retriving the implementation of
  node-fetch via await import() calls

- Add webpack file for compiling node-fetch to electron-renderer single
  file format

Signed-off-by: Sebastian Malton <sebastian@malton.name>
2022-10-31 14:40:02 -04:00

19 lines
657 B
TypeScript

/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import { getInjectable } from "@ogre-tools/injectable";
import { fetchImplInjectionToken } from "../../common/fetch/fetch.injectable";
import type * as FetchModule from "node-fetch";
const importFetchModule = new Function("return import('node-fetch')") as () => Promise<typeof FetchModule>;
const fetchImplInjectable = getInjectable({
id: "fetch-impl",
instantiate: () => importFetchModule(),
injectionToken: fetchImplInjectionToken,
causesSideEffects: true,
});
export default fetchImplInjectable;