Skip to content

Commit b48ab94

Browse files
committed
Fork Babel config and reduce supported browsers
1 parent 8b2d378 commit b48ab94

File tree

2 files changed

+34
-6
lines changed

2 files changed

+34
-6
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
module.exports = api => {
2+
const isTest = api.env('test');
3+
4+
const plugins = [
5+
['@babel/plugin-transform-flow-strip-types'],
6+
['@babel/plugin-proposal-class-properties', {loose: false}],
7+
8+
// The plugins below fix compilation errors on Webpack 4.
9+
// See: https://github.com/webpack/webpack/issues/10227
10+
// TODO: Remove once we're on Webpack 5.
11+
['@babel/plugin-proposal-optional-chaining'],
12+
['@babel/plugin-proposal-nullish-coalescing-operator'],
13+
];
14+
if (process.env.NODE_ENV !== 'production') {
15+
plugins.push(['@babel/plugin-transform-react-jsx-source']);
16+
}
17+
18+
return {
19+
plugins,
20+
presets: [
21+
[
22+
'@babel/preset-env',
23+
{
24+
targets: isTest
25+
? {node: 'current'}
26+
: 'last 2 Chrome versions, last 2 Firefox versions',
27+
},
28+
],
29+
'@babel/preset-react',
30+
'@babel/preset-flow',
31+
],
32+
};
33+
};

packages/react-devtools-scheduling-profiler/webpack.config.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,7 @@ const DEVTOOLS_VERSION = getVersionString();
2727
const imageInlineSizeLimit = 10000;
2828

2929
const babelOptions = {
30-
configFile: resolve(
31-
__dirname,
32-
'..',
33-
'react-devtools-shared',
34-
'babel.config.js',
35-
),
30+
configFile: resolve(__dirname, 'babel.config.js'),
3631
plugins: shouldUseDevServer
3732
? [resolve(builtModulesDir, 'react-refresh/babel')]
3833
: [],

0 commit comments

Comments
 (0)