Skip to content

Commit

Permalink
Strip flow syntax before any other transform (#5182)
Browse files Browse the repository at this point in the history
* Strip flow syntax before any other transform
Plugins run before presets so we can't use the flow preset

* Add informative comment
  • Loading branch information
Timer authored Oct 1, 2018
1 parent 70b3110 commit 72d4ab0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion packages/babel-preset-react-app/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,13 @@ module.exports = function(api, opts, env) {
useBuiltIns: true,
},
],
isFlowEnabled && [require('@babel/preset-flow').default],
].filter(Boolean),
plugins: [
// Strip flow types before any other transform, emulating the behavior
// order as-if the browser supported all of the succeeding features
// https://github.com/facebook/create-react-app/pull/5182
isFlowEnabled &&
require('@babel/plugin-transform-flow-strip-types').default,
// Experimental macros support. Will be documented after it's had some time
// in the wild.
require('babel-plugin-macros'),
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-preset-react-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
"@babel/plugin-syntax-dynamic-import": "7.0.0",
"@babel/plugin-transform-classes": "7.1.0",
"@babel/plugin-transform-destructuring": "7.0.0",
"@babel/plugin-transform-flow-strip-types": "7.0.0",
"@babel/plugin-transform-react-constant-elements": "7.0.0",
"@babel/plugin-transform-react-display-name": "7.0.0",
"@babel/plugin-transform-runtime": "7.1.0",
"@babel/preset-env": "7.1.0",
"@babel/preset-flow": "7.0.0",
"@babel/preset-react": "7.0.0",
"@babel/runtime": "7.0.0",
"babel-loader": "8.0.4",
Expand Down

0 comments on commit 72d4ab0

Please sign in to comment.