Skip to content

Commit

Permalink
Fork Babel config and reduce supported browsers
Browse files Browse the repository at this point in the history
  • Loading branch information
taneliang committed Sep 21, 2020
1 parent 8b2d378 commit b48ab94
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 6 deletions.
33 changes: 33 additions & 0 deletions packages/react-devtools-scheduling-profiler/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
module.exports = api => {
const isTest = api.env('test');

const plugins = [
['@babel/plugin-transform-flow-strip-types'],
['@babel/plugin-proposal-class-properties', {loose: false}],

// The plugins below fix compilation errors on Webpack 4.
// See: https://github.com/webpack/webpack/issues/10227
// TODO: Remove once we're on Webpack 5.
['@babel/plugin-proposal-optional-chaining'],
['@babel/plugin-proposal-nullish-coalescing-operator'],
];
if (process.env.NODE_ENV !== 'production') {
plugins.push(['@babel/plugin-transform-react-jsx-source']);
}

return {
plugins,
presets: [
[
'@babel/preset-env',
{
targets: isTest
? {node: 'current'}
: 'last 2 Chrome versions, last 2 Firefox versions',
},
],
'@babel/preset-react',
'@babel/preset-flow',
],
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,7 @@ const DEVTOOLS_VERSION = getVersionString();
const imageInlineSizeLimit = 10000;

const babelOptions = {
configFile: resolve(
__dirname,
'..',
'react-devtools-shared',
'babel.config.js',
),
configFile: resolve(__dirname, 'babel.config.js'),
plugins: shouldUseDevServer
? [resolve(builtModulesDir, 'react-refresh/babel')]
: [],
Expand Down

0 comments on commit b48ab94

Please sign in to comment.