From 57961ae5d79a39f717b977974cd5b5bc5bc7b754 Mon Sep 17 00:00:00 2001 From: PalmDevs Date: Sun, 2 Aug 2026 00:05:18 +0700 Subject: [PATCH] fix(lib/plugins): ignore re-registration for internal plugins --- lib/plugins/src/_internal/index.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/plugins/src/_internal/index.ts b/lib/plugins/src/_internal/index.ts index c6f50de..aa8a54a 100644 --- a/lib/plugins/src/_internal/index.ts +++ b/lib/plugins/src/_internal/index.ts @@ -345,6 +345,7 @@ export function registerInternalPlugin( iflags = 0, ) { manifest.version ??= InternalPluginVersion + // TODO: This has to be shared from native somehow. manifest.format ??= 1 manifest.dependencies ??= {} manifest.dependencies[ApiDependencyId] ??= { version: '*' } @@ -359,8 +360,13 @@ function register( defflags: number, iflags: number, ) { - if (pList.has(manifest.id)) - throw new Error(`Plugin with ID "${manifest.id}" already registered`) + if (pList.has(manifest.id)) { + // Ignore re-registration if internal + if (!iflags) + throw new Error( + `Plugin with ID "${manifest.id}" already registered`, + ) + } const factory = typeof options === 'function' ? options : undefined const resolved = typeof options === 'function' ? undefined : options