Skip to content

Commit

Permalink
New: Enable React automatic runtime transforms ๐Ÿ’– (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
DHedgecock committed Oct 15, 2020
1 parent 4d23b07 commit 6214d46
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/__snapshots__/index.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Object {
"@babel/preset-react",
Object {
"development": true,
"useBuiltIns": true,
"runtime": "automatic",
},
],
"@babel/preset-typescript",
Expand Down Expand Up @@ -124,7 +124,7 @@ Object {
"@babel/preset-react",
Object {
"development": false,
"useBuiltIns": true,
"runtime": "automatic",
},
],
"@babel/preset-typescript",
Expand Down Expand Up @@ -173,7 +173,7 @@ Object {
"@babel/preset-react",
Object {
"development": false,
"useBuiltIns": true,
"runtime": "automatic",
},
],
"@babel/preset-typescript",
Expand Down
8 changes: 5 additions & 3 deletions src/react.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,11 @@ export default function reactConfigs(env: Env): TransformOptions {
},
],

// Includes plugins required to transform JSX. Development plugins add
// references to source and self on each component
['@babel/preset-react', { development: env('development'), useBuiltIns: true }],
// Includes plugins required to transform JSX and opts in to the automatic
// runtime which auto imports the functions that JSX transpiles to.
// Development option toggles plugins that add references to source and
// self on each component
['@babel/preset-react', { development: env('development'), runtime: 'automatic' }],

// Enable TypeScript usage ๐Ÿ”
'@babel/preset-typescript',
Expand Down

0 comments on commit 6214d46

Please sign in to comment.