From 89198db355131a096d33cacc6929dcf2d8c8a64e Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Tue, 21 Jan 2025 16:33:02 -0500 Subject: [PATCH] fix(ssr): remove dev-only accessor warnings (#5135) --- .../@lwc/engine-core/src/framework/base-bridge-element.ts | 5 ++++- .../as-component-prop/without-@api/expected.html | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/@lwc/engine-core/src/framework/base-bridge-element.ts b/packages/@lwc/engine-core/src/framework/base-bridge-element.ts index 0d5dbea546..727cb22aef 100644 --- a/packages/@lwc/engine-core/src/framework/base-bridge-element.ts +++ b/packages/@lwc/engine-core/src/framework/base-bridge-element.ts @@ -150,7 +150,10 @@ export function HTMLBridgeElementFactory( const descriptors: PropertyDescriptorMap = create(null); // present a hint message so that developers are aware that they have not decorated property with @api - if (process.env.NODE_ENV !== 'production') { + // Note that we also don't do this in SSR because we cannot sniff for what props are declared on + // HTMLElementPrototype, and it seems not worth it to have these dev-only warnings there, since + // an `in` check could mistakenly assume that a prop is declared on a LightningElement prototype. + if (process.env.NODE_ENV !== 'production' && process.env.IS_BROWSER) { // TODO [#3761]: enable for components that don't extend from LightningElement if (!isUndefined(proto) && !isNull(proto) && !hasCustomSuperClass) { const nonPublicPropertiesToWarnOn = new Set( diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/attribute-global-html/as-component-prop/without-@api/expected.html b/packages/@lwc/engine-server/src/__tests__/fixtures/attribute-global-html/as-component-prop/without-@api/expected.html index 94aa7b3829..72e5459916 100644 --- a/packages/@lwc/engine-server/src/__tests__/fixtures/attribute-global-html/as-component-prop/without-@api/expected.html +++ b/packages/@lwc/engine-server/src/__tests__/fixtures/attribute-global-html/as-component-prop/without-@api/expected.html @@ -1,6 +1,6 @@