File tree 7 files changed +31
-44
lines changed
7 files changed +31
-44
lines changed Original file line number Diff line number Diff line change 6
6
*/
7
7
'use strict' ;
8
8
9
- const loader = require ( 'babel-loader' ) ;
10
- const overrides = require ( './overrides' ) ;
9
+ const crypto = require ( 'crypto' ) ;
11
10
12
- module . exports = loader . custom ( ( ) => overrides ) ;
11
+ module . exports = function ( ) {
12
+ return {
13
+ // This function transforms the Babel configuration on a per-file basis
14
+ config ( config , { source } ) {
15
+ // Babel Macros are notoriously hard to cache, so they shouldn't be
16
+ // https://github.com/babel/babel/issues/8497
17
+ // We naively detect macros using their package suffix and insert a random
18
+ // caller name, a valid option accepted by Babel, to compose a one-time
19
+ // cacheIdentifier for the file. We cannot tune the loader options on a per
20
+ // file basis.
21
+ if ( source . indexOf ( '.macro' ) !== - 1 || source . indexOf ( '/macro' ) !== - 1 ) {
22
+ return {
23
+ ...config . options ,
24
+ caller : {
25
+ name : 'babel-preset-react-app' ,
26
+ craInvalidationToken : crypto . randomBytes ( 32 ) . toString ( 'hex' ) ,
27
+ } ,
28
+ } ;
29
+ }
30
+ return config . options ;
31
+ } ,
32
+ } ;
33
+ } ;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 13
13
" dev.js" ,
14
14
" index.js" ,
15
15
" loader.js" ,
16
- " overrides.js" ,
17
16
" prod.js" ,
18
17
" test.js"
19
18
],
31
30
"@babel/preset-flow" : " 7.0.0" ,
32
31
"@babel/preset-react" : " 7.0.0" ,
33
32
"@babel/runtime" : " 7.0.0" ,
34
- "babel-loader" : " 8.0.2 " ,
33
+ "babel-loader" : " 8.0.4 " ,
35
34
"babel-plugin-macros" : " 2.4.2" ,
36
35
"babel-plugin-transform-dynamic-import" : " 2.1.0" ,
37
36
"babel-plugin-transform-react-remove-prop-types" : " 0.4.18"
Original file line number Diff line number Diff line change 36
36
"babel-core" : " 7.0.0-bridge.0" ,
37
37
"babel-eslint" : " 9.0.0" ,
38
38
"babel-jest" : " 23.6.0" ,
39
- "babel-loader" : " 8.0.2 " ,
39
+ "babel-loader" : " 8.0.4 " ,
40
40
"babel-preset-react-app" : " ^4.0.0" ,
41
41
"chalk" : " ^2.3.2" ,
42
42
"chokidar" : " ^2.0.2" ,
Original file line number Diff line number Diff line change @@ -218,11 +218,9 @@ module.exports = {
218
218
} ,
219
219
} ,
220
220
{
221
- // We need to use our own loader until `babel-loader` supports
222
- // customization
223
- // https://github.com/babel/babel-loader/pull/687
224
- loader : require . resolve ( 'babel-preset-react-app/loader' ) ,
221
+ loader : require . resolve ( 'babel-loader' ) ,
225
222
options : {
223
+ customize : require . resolve ( 'babel-preset-react-app/loader' ) ,
226
224
// @remove -on-eject-begin
227
225
babelrc : false ,
228
226
configFile : false ,
Original file line number Diff line number Diff line change @@ -272,8 +272,9 @@ module.exports = {
272
272
// We need to use our own loader until `babel-loader` supports
273
273
// customization
274
274
// https://github.com/babel/babel-loader/pull/687
275
- loader : require . resolve ( 'babel-preset-react-app/ loader' ) ,
275
+ loader : require . resolve ( 'babel-loader' ) ,
276
276
options : {
277
+ customize : require . resolve ( 'babel-preset-react-app/loader' ) ,
277
278
// @remove -on-eject-begin
278
279
babelrc : false ,
279
280
configFile : false ,
Original file line number Diff line number Diff line change 26
26
"babel-core" : " 7.0.0-bridge.0" ,
27
27
"babel-eslint" : " 9.0.0" ,
28
28
"babel-jest" : " 23.6.0" ,
29
- "babel-loader" : " 8.0.2 " ,
29
+ "babel-loader" : " 8.0.4 " ,
30
30
"babel-plugin-named-asset-import" : " ^0.2.0" ,
31
31
"babel-preset-react-app" : " ^4.0.0" ,
32
32
"bfj" : " 6.1.1" ,
You can’t perform that action at this time.
0 commit comments