Webpack et al. provide features like ProvidePlugin that makes an identifier globally available during a build even without being declared in any scope.
Add a pragma option that supports adding a display name when React is not in scope via an import declaration. For example a webpack project may include something like:
plugins: [
new webpack.ProvidePlugin({
"React": "react",
})
]
in which case if the pragma option is set to React then (i.e. no explicit import)
const Foo = React.memo(() => {
return <>foo</>
})
would still cause Foo.displayName = 'Foo' to be added.
Webpack et al. provide features like
ProvidePluginthat makes an identifier globally available during a build even without being declared in any scope.Add a
pragmaoption that supports adding a display name whenReactis not in scope via animportdeclaration. For example a webpack project may include something like:in which case if the
pragmaoption is set toReactthen (i.e. no explicitimport)would still cause
Foo.displayName = 'Foo'to be added.