@@ -23,6 +23,7 @@ const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
2323const getCSSModuleLocalIdent = require ( 'react-dev-utils/getCSSModuleLocalIdent' ) ;
2424const paths = require ( './paths' ) ;
2525const getClientEnvironment = require ( './env' ) ;
26+ const getCacheIdentifier = require ( 'react-dev-utils/getCacheIdentifier' ) ;
2627
2728// Webpack uses `publicPath` to determine where the app is being served from.
2829// It requires a trailing slash, or the file assets will get an incorrect path.
@@ -269,6 +270,17 @@ module.exports = {
269270 // @remove -on-eject-begin
270271 babelrc : false ,
271272 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+ ] ) ,
272284 // @remove -on-eject-end
273285 plugins : [
274286 [
@@ -310,6 +322,14 @@ module.exports = {
310322 cacheDirectory : true ,
311323 // Save disk space when time isn't as important
312324 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
313333 highlightCode : true ,
314334 } ,
315335 } ,
0 commit comments