File tree Expand file tree Collapse file tree 2 files changed +34
-6
lines changed
packages/react-devtools-scheduling-profiler Expand file tree Collapse file tree 2 files changed +34
-6
lines changed Original file line number Diff line number Diff line change
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
+ } ;
Original file line number Diff line number Diff line change @@ -27,12 +27,7 @@ const DEVTOOLS_VERSION = getVersionString();
27
27
const imageInlineSizeLimit = 10000 ;
28
28
29
29
const babelOptions = {
30
- configFile : resolve (
31
- __dirname ,
32
- '..' ,
33
- 'react-devtools-shared' ,
34
- 'babel.config.js' ,
35
- ) ,
30
+ configFile : resolve ( __dirname , 'babel.config.js' ) ,
36
31
plugins : shouldUseDevServer
37
32
? [ resolve ( builtModulesDir , 'react-refresh/babel' ) ]
38
33
: [ ] ,
You can’t perform that action at this time.
0 commit comments