File tree 6 files changed +57
-4
lines changed
6 files changed +57
-4
lines changed Original file line number Diff line number Diff line change 7
7
"es6": true
8
8
},
9
9
"parserOptions": {
10
- "ecmaVersion": 6
10
+ "ecmaVersion": 2018
11
11
},
12
12
"rules": {
13
13
"no-console": "off",
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Copyright (c) 2015-present, Facebook, Inc.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ 'use strict' ;
8
+
9
+ const loader = require ( 'babel-loader' ) ;
10
+ const overrides = require ( './overrides' ) ;
11
+
12
+ module . exports = loader . custom ( ( ) => overrides ) ;
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Copyright (c) 2015-present, Facebook, Inc.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ 'use strict' ;
8
+
9
+ const crypto = require ( 'crypto' ) ;
10
+
11
+ module . exports = {
12
+ // This function transforms the Babel configuration on a per-file basis
13
+ config ( config , { source } ) {
14
+ // Babel Macros are notoriously hard to cache, so they shouldn't be
15
+ // https://github.com/babel/babel/issues/8497
16
+ // We naively detect macros using their package suffix and insert a random
17
+ // caller name, a valid option accepted by Babel, to compose a one-time
18
+ // cacheIdentifier for the file. We cannot tune the loader options on a per
19
+ // file basis.
20
+ if ( source . indexOf ( '.macro' ) !== - 1 || source . indexOf ( '/macro' ) !== - 1 ) {
21
+ return {
22
+ ...config . options ,
23
+ caller : {
24
+ name : `babel-preset-react-app:${ crypto
25
+ . randomBytes ( 32 )
26
+ . toString ( 'hex' ) } `,
27
+ } ,
28
+ } ;
29
+ }
30
+ return config . options ;
31
+ } ,
32
+ } ;
Original file line number Diff line number Diff line change 8
8
"url" : " https://github.com/facebook/create-react-app/issues"
9
9
},
10
10
"files" : [
11
- " index.js" ,
12
11
" create.js" ,
13
12
" dependencies.js" ,
14
13
" dev.js" ,
14
+ " index.js" ,
15
+ " loader.js" ,
16
+ " overrides.js" ,
15
17
" prod.js" ,
16
18
" test.js"
17
19
],
29
31
"@babel/preset-env" : " 7.1.0" ,
30
32
"@babel/preset-flow" : " 7.0.0" ,
31
33
"@babel/preset-react" : " 7.0.0" ,
34
+ "babel-loader" : " 8.0.2" ,
32
35
"babel-plugin-macros" : " 2.4.2" ,
33
36
"babel-plugin-transform-dynamic-import" : " 2.1.0" ,
34
37
"babel-plugin-transform-react-remove-prop-types" : " 0.4.18"
Original file line number Diff line number Diff line change @@ -228,7 +228,10 @@ module.exports = {
228
228
} ,
229
229
} ,
230
230
{
231
- loader : require . resolve ( 'babel-loader' ) ,
231
+ // We need to use our own loader until `babel-loader` supports
232
+ // customization
233
+ // https://github.com/babel/babel-loader/pull/687
234
+ loader : require . resolve ( 'babel-preset-react-app/loader' ) ,
232
235
options : {
233
236
// @remove -on-eject-begin
234
237
babelrc : false ,
Original file line number Diff line number Diff line change @@ -266,7 +266,10 @@ module.exports = {
266
266
// improves compile time on larger projects
267
267
require . resolve ( 'thread-loader' ) ,
268
268
{
269
- loader : require . resolve ( 'babel-loader' ) ,
269
+ // We need to use our own loader until `babel-loader` supports
270
+ // customization
271
+ // https://github.com/babel/babel-loader/pull/687
272
+ loader : require . resolve ( 'babel-preset-react-app/loader' ) ,
270
273
options : {
271
274
// @remove -on-eject-begin
272
275
babelrc : false ,
You can’t perform that action at this time.
0 commit comments