@@ -23,6 +23,7 @@ const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
23
23
const getCSSModuleLocalIdent = require ( 'react-dev-utils/getCSSModuleLocalIdent' ) ;
24
24
const paths = require ( './paths' ) ;
25
25
const getClientEnvironment = require ( './env' ) ;
26
+ const getCacheIdentifier = require ( 'react-dev-utils/getCacheIdentifier' ) ;
26
27
27
28
// Webpack uses `publicPath` to determine where the app is being served from.
28
29
// It requires a trailing slash, or the file assets will get an incorrect path.
@@ -269,6 +270,17 @@ module.exports = {
269
270
// @remove -on-eject-begin
270
271
babelrc : false ,
271
272
presets : [ require . resolve ( 'babel-preset-react-app' ) ] ,
273
+ // Make sure we have a unique cache identifier, erring on the
274
+ // side of caution.
275
+ // We remove this when the user ejects because the default
276
+ // is sane and uses Babel options. Instead of options, we use
277
+ // the react-scripts and babel-preset-react-app versions.
278
+ cacheIdentifier : getCacheIdentifier ( 'production' , [
279
+ 'babel-plugin-named-asset-import' ,
280
+ 'babel-preset-react-app' ,
281
+ 'react-dev-utils' ,
282
+ 'react-scripts' ,
283
+ ] ) ,
272
284
// @remove -on-eject-end
273
285
plugins : [
274
286
[
@@ -310,6 +322,14 @@ module.exports = {
310
322
cacheDirectory : true ,
311
323
// Save disk space when time isn't as important
312
324
cacheCompression : true ,
325
+ // @remove -on-eject-begin
326
+ cacheIdentifier : getCacheIdentifier ( 'production' , [
327
+ 'babel-plugin-named-asset-import' ,
328
+ 'babel-preset-react-app' ,
329
+ 'react-dev-utils' ,
330
+ 'react-scripts' ,
331
+ ] ) ,
332
+ // @remove -on-eject-end
313
333
highlightCode : true ,
314
334
} ,
315
335
} ,
0 commit comments