From 1c5d1d1da0af28b979b1fcacf9044e8ce6be2b2b Mon Sep 17 00:00:00 2001 From: benjdlambert Date: Fri, 8 Aug 2025 15:06:37 +0200 Subject: [PATCH] chore: force installation of extensions in app plugin Signed-off-by: benjdlambert --- plugins/app/src/extensions/SwappableComponentsApi.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/plugins/app/src/extensions/SwappableComponentsApi.ts b/plugins/app/src/extensions/SwappableComponentsApi.ts index ea57a6f487..a1a4c826ca 100644 --- a/plugins/app/src/extensions/SwappableComponentsApi.ts +++ b/plugins/app/src/extensions/SwappableComponentsApi.ts @@ -39,9 +39,14 @@ export const SwappableComponentsApi = ApiBlueprint.makeWithOverrides({ deps: {}, factory: () => DefaultSwappableComponentsApi.fromComponents( - inputs.components.map(i => - i.get(SwappableComponentBlueprint.dataRefs.component), - ), + inputs.components.map(i => { + if (i.node.spec.plugin?.id !== 'app') { + throw new Error( + `SwappableComponents can only be installed as an extension in the app plugin. You can either use appPlugin.override(), or provide a module for the app-plugin with the extension there instead. id={${i.node.spec.id}}`, + ); + } + return i.get(SwappableComponentBlueprint.dataRefs.component); + }), ), }), );