babel-preset-react-app 7.0.2 → 9.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. package/create.js +25 -12
  2. package/dependencies.js +28 -11
  3. package/package.json +18 -15
package/create.js CHANGED
@@ -79,17 +79,11 @@ module.exports = function(api, opts, env) {
79
79
  // Latest stable ECMAScript features
80
80
  require('@babel/preset-env').default,
81
81
  {
82
- // We want Create React App to be IE 9 compatible until React itself
83
- // no longer works with IE 9
84
- targets: {
85
- ie: 9,
86
- },
87
- // Users cannot override this behavior because this Babel
88
- // configuration is highly tuned for ES5 support
89
- ignoreBrowserslistConfig: true,
90
- // If users import all core-js they're probably not concerned with
91
- // bundle size. We shouldn't rely on magic to try and shrink it.
92
- useBuiltIns: false,
82
+ // Allow importing core-js in entrypoint and use browserlist to select polyfills
83
+ useBuiltIns: 'entry',
84
+ // Set the corejs version we are using to avoid warnings in console
85
+ // This will need to change once we upgrade to corejs@3
86
+ corejs: 3,
93
87
  // Do not transform modules to CJS
94
88
  modules: false,
95
89
  // Exclude transforms that make all code slower
@@ -126,7 +120,26 @@ module.exports = function(api, opts, env) {
126
120
  // Necessary to include regardless of the environment because
127
121
  // in practice some other transforms (such as object-rest-spread)
128
122
  // don't work without it: https://github.com/babel/babel/issues/7215
129
- require('@babel/plugin-transform-destructuring').default,
123
+ [
124
+ require('@babel/plugin-transform-destructuring').default,
125
+ {
126
+ // Use loose mode for performance:
127
+ // https://github.com/facebook/create-react-app/issues/5602
128
+ loose: false,
129
+ selectiveLoose: [
130
+ 'useState',
131
+ 'useEffect',
132
+ 'useContext',
133
+ 'useReducer',
134
+ 'useCallback',
135
+ 'useMemo',
136
+ 'useRef',
137
+ 'useImperativeHandle',
138
+ 'useLayoutEffect',
139
+ 'useDebugValue',
140
+ ],
141
+ },
142
+ ],
130
143
  // Turn on legacy decorators for TypeScript files
131
144
  isTypeScriptEnabled && [
132
145
  require('@babel/plugin-proposal-decorators').default,
package/dependencies.js CHANGED
@@ -84,17 +84,11 @@ module.exports = function(api, opts) {
84
84
  // Latest stable ECMAScript features
85
85
  require('@babel/preset-env').default,
86
86
  {
87
- // We want Create React App to be IE 9 compatible until React itself
88
- // no longer works with IE 9
89
- targets: {
90
- ie: 9,
91
- },
92
- // Users cannot override this behavior because this Babel
93
- // configuration is highly tuned for ES5 support
94
- ignoreBrowserslistConfig: true,
95
- // If users import all core-js they're probably not concerned with
96
- // bundle size. We shouldn't rely on magic to try and shrink it.
97
- useBuiltIns: false,
87
+ // Allow importing core-js in entrypoint and use browserlist to select polyfills
88
+ useBuiltIns: 'entry',
89
+ // Set the corejs version we are using to avoid warnings in console
90
+ // This will need to change once we upgrade to corejs@3
91
+ corejs: 3,
98
92
  // Do not transform modules to CJS
99
93
  modules: false,
100
94
  // Exclude transforms that make all code slower
@@ -103,6 +97,29 @@ module.exports = function(api, opts) {
103
97
  ],
104
98
  ].filter(Boolean),
105
99
  plugins: [
100
+ // Necessary to include regardless of the environment because
101
+ // in practice some other transforms (such as object-rest-spread)
102
+ // don't work without it: https://github.com/babel/babel/issues/7215
103
+ [
104
+ require('@babel/plugin-transform-destructuring').default,
105
+ {
106
+ // Use loose mode for performance:
107
+ // https://github.com/facebook/create-react-app/issues/5602
108
+ loose: false,
109
+ selectiveLoose: [
110
+ 'useState',
111
+ 'useEffect',
112
+ 'useContext',
113
+ 'useReducer',
114
+ 'useCallback',
115
+ 'useMemo',
116
+ 'useRef',
117
+ 'useImperativeHandle',
118
+ 'useLayoutEffect',
119
+ 'useDebugValue',
120
+ ],
121
+ },
122
+ ],
106
123
  // Polyfills the runtime needed for async/await, generators, and friends
107
124
  // https://babeljs.io/docs/en/babel-plugin-transform-runtime
108
125
  [
package/package.json CHANGED
@@ -1,8 +1,12 @@
1
1
  {
2
2
  "name": "babel-preset-react-app",
3
- "version": "7.0.2",
3
+ "version": "9.0.0",
4
4
  "description": "Babel preset used by Create React App",
5
- "repository": "facebook/create-react-app",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/facebook/create-react-app.git",
8
+ "directory": "packages/babel-preset-react-app"
9
+ },
6
10
  "license": "MIT",
7
11
  "bugs": {
8
12
  "url": "https://github.com/facebook/create-react-app/issues"
@@ -17,24 +21,23 @@
17
21
  "test.js"
18
22
  ],
19
23
  "dependencies": {
20
- "@babel/core": "7.2.2",
21
- "@babel/plugin-proposal-class-properties": "7.3.0",
22
- "@babel/plugin-proposal-decorators": "7.3.0",
23
- "@babel/plugin-proposal-object-rest-spread": "7.3.2",
24
+ "@babel/core": "7.4.3",
25
+ "@babel/plugin-proposal-class-properties": "7.4.0",
26
+ "@babel/plugin-proposal-decorators": "7.4.0",
27
+ "@babel/plugin-proposal-object-rest-spread": "7.4.3",
24
28
  "@babel/plugin-syntax-dynamic-import": "7.2.0",
25
- "@babel/plugin-transform-classes": "7.2.2",
26
- "@babel/plugin-transform-destructuring": "7.3.2",
27
- "@babel/plugin-transform-flow-strip-types": "7.2.3",
29
+ "@babel/plugin-transform-classes": "7.4.3",
30
+ "@babel/plugin-transform-destructuring": "7.4.3",
31
+ "@babel/plugin-transform-flow-strip-types": "7.4.0",
28
32
  "@babel/plugin-transform-react-constant-elements": "7.2.0",
29
33
  "@babel/plugin-transform-react-display-name": "7.2.0",
30
- "@babel/plugin-transform-runtime": "7.2.0",
31
- "@babel/preset-env": "7.3.1",
34
+ "@babel/plugin-transform-runtime": "7.4.3",
35
+ "@babel/preset-env": "7.4.3",
32
36
  "@babel/preset-react": "7.0.0",
33
- "@babel/preset-typescript": "7.1.0",
34
- "@babel/runtime": "7.3.1",
35
- "babel-loader": "8.0.5",
37
+ "@babel/preset-typescript": "7.3.3",
38
+ "@babel/runtime": "7.4.3",
36
39
  "babel-plugin-dynamic-import-node": "2.2.0",
37
- "babel-plugin-macros": "2.5.0",
40
+ "babel-plugin-macros": "2.5.1",
38
41
  "babel-plugin-transform-react-remove-prop-types": "0.4.24"
39
42
  }
40
43
  }