Skip to content

[labs/react] __forwardedRef is being minified in prod builds #3211

@justinfagnani

Description

@justinfagnani

Which package(s) are affected?

React (@lit-labs/react)

Description

__forwardedRef matches our our Terser property name mangling config, so it's being minified. This is noticeable because the prod tests trigger a React warning that _$Gl isn't a valid attribute name, which is caused by us adding __forwardedRef to props here: https://github.com/lit/lit/blob/main/packages/labs/react/src/create-component.ts#L250

This should mean that user refs are broken, but we have a ref test, so we need to check our coverage here.

We can prevent the mangling either by adding '__forwardedRef' to our global reserved property names, or by setting Terser's keep_quoted option to true.

Reproduction

Run the react tests

Workaround

none

Is this a regression?

No or unsure. This never worked, or I haven't tried before.

Affected versions

all

Browser/OS/Node environment

all

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions