mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
- 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>
19 lines
657 B
TypeScript
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;
|