Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(babel-preset-gatsby): allow setting importSource on preset-react (…
…#29260) * feat(babel-preset-gatsby): allow passing importSource to preset-react With React 17's new JSX transform feature, it is possible to pass a custom JSX factory besides React's default one. This is useful when working with libraries like Emotion 11: https://emotion.sh/docs/css-prop#babel-preset. In order to support this feature in `babel-preset-gatsby`, this PR adds an option called `reactImportSource` that is passed down to the underlying `@babel/preset-react` preset option `importSource`. Users of `babel-preset-gatsby` can then use this like so: ```json { "presets": [ [ "babel-preset-gatsby", { "reactRuntime": "automatic", "reactImportSource": "@emotion/react" } ] ] } ``` * conditionally pass through the preset option rather than undefined * throwing if runtime is wrong, move the logic out of the object * clean up tests, change syntax Co-authored-by: Laurie <laurie@gatsbyjs.com>
- Loading branch information