Skip to content

Commit b855da5

Browse files
Remove outdated babel plugins (#8353)
Updates dependencies and removes babel plugins that are now covered by `@babel/preset-env`. Co-authored-by: hdineen <hdineen@hubspot.com>
1 parent 4bf14fa commit b855da5

File tree

10 files changed

+1224
-1129
lines changed

10 files changed

+1224
-1129
lines changed

package.json

+3
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@
4343
"tempy": "^0.2.1",
4444
"wait-for-localhost": "^3.1.0"
4545
},
46+
"resolutions": {
47+
"mkdirp": "0.5.1"
48+
},
4649
"husky": {
4750
"hooks": {
4851
"pre-commit": "lint-staged"

packages/babel-preset-react-app/create.js

+23-41
Original file line numberDiff line numberDiff line change
@@ -117,29 +117,29 @@ module.exports = function(api, opts, env) {
117117
// Experimental macros support. Will be documented after it's had some time
118118
// in the wild.
119119
require('babel-plugin-macros'),
120-
// Necessary to include regardless of the environment because
121-
// in practice some other transforms (such as object-rest-spread)
122-
// don't work without it: https://github.com/babel/babel/issues/7215
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-
],
120+
// Disabled as it's handled automatically by preset-env, and `selectiveLoose` isn't
121+
// yet merged into babel: https://github.com/babel/babel/pull/9486
122+
// Related: https://github.com/facebook/create-react-app/pull/8215
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+
// ],
143143
// Turn on legacy decorators for TypeScript files
144144
isTypeScriptEnabled && [
145145
require('@babel/plugin-proposal-decorators').default,
@@ -156,15 +156,6 @@ module.exports = function(api, opts, env) {
156156
],
157157
// Adds Numeric Separators
158158
require('@babel/plugin-proposal-numeric-separator').default,
159-
// The following two plugins use Object.assign directly, instead of Babel's
160-
// extends helper. Note that this assumes `Object.assign` is available.
161-
// { ...todo, completed: true }
162-
[
163-
require('@babel/plugin-proposal-object-rest-spread').default,
164-
{
165-
useBuiltIns: true,
166-
},
167-
],
168159
// Polyfills the runtime needed for async/await, generators, and friends
169160
// https://babeljs.io/docs/en/babel-plugin-transform-runtime
170161
[
@@ -194,15 +185,6 @@ module.exports = function(api, opts, env) {
194185
removeImport: true,
195186
},
196187
],
197-
// Adds syntax support for import()
198-
require('@babel/plugin-syntax-dynamic-import').default,
199-
// Adds syntax support for optional chaining (?.)
200-
require('@babel/plugin-proposal-optional-chaining').default,
201-
// Adds syntax support for default value using ?? operator
202-
require('@babel/plugin-proposal-nullish-coalescing-operator').default,
203-
isEnvTest &&
204-
// Transform dynamic import to require
205-
require('babel-plugin-dynamic-import-node'),
206188
].filter(Boolean),
207189
overrides: [
208190
isFlowEnabled && {

packages/babel-preset-react-app/dependencies.js

+23-28
Original file line numberDiff line numberDiff line change
@@ -97,29 +97,29 @@ module.exports = function(api, opts) {
9797
],
9898
].filter(Boolean),
9999
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-
],
100+
// Disabled as it's handled automatically by preset-env, and `selectiveLoose` isn't
101+
// yet merged into babel: https://github.com/babel/babel/pull/9486
102+
// Related: https://github.com/facebook/create-react-app/pull/8215
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+
// ],
123123
// Polyfills the runtime needed for async/await, generators, and friends
124124
// https://babeljs.io/docs/en/babel-plugin-transform-runtime
125125
[
@@ -138,11 +138,6 @@ module.exports = function(api, opts) {
138138
absoluteRuntime: absoluteRuntimePath,
139139
},
140140
],
141-
// Adds syntax support for import()
142-
require('@babel/plugin-syntax-dynamic-import').default,
143-
isEnvTest &&
144-
// Transform dynamic import to require
145-
require('babel-plugin-dynamic-import-node'),
146141
].filter(Boolean),
147142
};
148143
};

packages/babel-preset-react-app/package.json

+8-14
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,17 @@
2121
"test.js"
2222
],
2323
"dependencies": {
24-
"@babel/core": "7.8.3",
24+
"@babel/core": "7.8.4",
2525
"@babel/plugin-proposal-class-properties": "7.8.3",
2626
"@babel/plugin-proposal-decorators": "7.8.3",
27-
"@babel/plugin-proposal-nullish-coalescing-operator": "7.8.3",
2827
"@babel/plugin-proposal-numeric-separator": "7.8.3",
29-
"@babel/plugin-proposal-object-rest-spread": "7.7.4",
30-
"@babel/plugin-proposal-optional-chaining": "7.8.3",
31-
"@babel/plugin-syntax-dynamic-import": "7.7.4",
32-
"@babel/plugin-transform-destructuring": "7.7.4",
33-
"@babel/plugin-transform-flow-strip-types": "7.7.4",
34-
"@babel/plugin-transform-react-display-name": "7.7.4",
35-
"@babel/plugin-transform-runtime": "7.7.6",
36-
"@babel/preset-env": "7.7.6",
37-
"@babel/preset-react": "7.7.4",
38-
"@babel/preset-typescript": "7.7.4",
39-
"@babel/runtime": "7.7.6",
40-
"babel-plugin-dynamic-import-node": "2.3.0",
28+
"@babel/plugin-transform-flow-strip-types": "7.8.3",
29+
"@babel/plugin-transform-react-display-name": "7.8.3",
30+
"@babel/plugin-transform-runtime": "7.8.3",
31+
"@babel/preset-env": "7.8.4",
32+
"@babel/preset-react": "7.8.3",
33+
"@babel/preset-typescript": "7.8.3",
34+
"@babel/runtime": "7.8.4",
4135
"babel-plugin-macros": "2.8.0",
4236
"babel-plugin-transform-react-remove-prop-types": "0.4.24"
4337
}

packages/create-react-app/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"envinfo": "7.5.0",
3333
"fs-extra": "8.1.0",
3434
"hyperquest": "2.1.3",
35-
"inquirer": "7.0.3",
35+
"inquirer": "7.0.4",
3636
"semver": "6.3.0",
3737
"tar-pack": "3.4.1",
3838
"tmp": "0.1.0",

0 commit comments

Comments
 (0)