mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix bundled extensions not being loaded (#7359)
* Fix bundled extensions not being loaded - Also show that this fixes it by added an example bundled extension to 'open-lens' Signed-off-by: Sebastian Malton <sebastian@malton.name> * Fix build Signed-off-by: Sebastian Malton <sebastian@malton.name> * Add explanatory comment for inline require Signed-off-by: Sebastian Malton <sebastian@malton.name> --------- Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
ae9a8c3c41
commit
2c3c88be04
51 files changed
+521
-159
No files matched your search
@@ -0,0 +1,21 @@
|
||||
import { bundledExtensionInjectionToken } from "@k8slens/legacy-extensions";
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import exampleBundledExtensionManifest from "@k8slens/legacy-extension-example/package.json";
|
||||
|
||||
const exampleBundledExtensionInjectable = getInjectable({
|
||||
id: "example-bundled-extension",
|
||||
instantiate: (di) => ({
|
||||
manifest: exampleBundledExtensionManifest,
|
||||
/**
|
||||
* Inline `require` is needed as to delay the loading and execution of the JS file until it is needed.
|
||||
*
|
||||
* Futhermore there might be code that runs "during load" and shouldn't be executed until everything is
|
||||
* setup for the extensions (ie globals).
|
||||
*/
|
||||
main: () => require("@k8slens/legacy-extension-example/main").default,
|
||||
renderer: () => require("@k8slens/legacy-extension-example/renderer").default,
|
||||
}),
|
||||
injectionToken: bundledExtensionInjectionToken,
|
||||
});
|
||||
|
||||
export default exampleBundledExtensionInjectable;
|
||||
Reference in new issue
Block a user