Skip to content

Support pragma option when React not in scope (via import). #15

@knightedcodemonkey

Description

@knightedcodemonkey

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions