diff --git a/packages/react-scripts/config/webpack.config.js b/packages/react-scripts/config/webpack.config.js index bad4290061b..876f738bc4b 100644 --- a/packages/react-scripts/config/webpack.config.js +++ b/packages/react-scripts/config/webpack.config.js @@ -38,6 +38,8 @@ const getCacheIdentifier = require('react-dev-utils/getCacheIdentifier'); // @remove-on-eject-end const postcssNormalize = require('postcss-normalize'); +const BUILD_ID = process.env.REACT_APP_BUILD_ID || ''; + const appPackageJson = require(paths.appPackageJson); // Source maps are resource heavy and can cause out of memory issue for large source files. @@ -184,14 +186,14 @@ module.exports = function(webpackEnv) { // There will be one main bundle, and one file per asynchronous chunk. // In development, it does not produce real files. filename: isEnvProduction - ? 'static/js/[name].[contenthash:8].js' - : isEnvDevelopment && 'static/js/bundle.js', + ? `static-${BUILD_ID}/js/[name].[contenthash:8].js` + : isEnvDevelopment && `static-${BUILD_ID}/js/bundle.js`, // TODO: remove this when upgrading to webpack 5 futureEmitAssets: true, // There are also additional JS chunk files if you use code splitting. chunkFilename: isEnvProduction - ? 'static/js/[name].[contenthash:8].chunk.js' - : isEnvDevelopment && 'static/js/[name].chunk.js', + ? `static-${BUILD_ID}/js/[name].[contenthash:8].chunk.js` + : isEnvDevelopment && `static-${BUILD_ID}/js/[name].chunk.js`, // We inferred the "public path" (such as / or /my-project) from homepage. // We use "/" in development. publicPath: publicPath, @@ -396,7 +398,7 @@ module.exports = function(webpackEnv) { loader: require.resolve('url-loader'), options: { limit: imageInlineSizeLimit, - name: 'static/media/[name].[hash:8].[ext]', + name: `static-${BUILD_ID}/media/[name].[hash:8].[ext]`, }, }, // Process application JS with Babel. @@ -570,7 +572,7 @@ module.exports = function(webpackEnv) { // by webpacks internal loaders. exclude: [/\.(js|mjs|jsx|ts|tsx)$/, /\.html$/, /\.json$/], options: { - name: 'static/media/[name].[hash:8].[ext]', + name: `static-${BUILD_ID}/media/[name].[hash:8].[ext]`, }, }, // ** STOP ** Are you adding a new loader? @@ -644,8 +646,8 @@ module.exports = function(webpackEnv) { new MiniCssExtractPlugin({ // Options similar to the same options in webpackOptions.output // both options are optional - filename: 'static/css/[name].[contenthash:8].css', - chunkFilename: 'static/css/[name].[contenthash:8].chunk.css', + filename: `static-${BUILD_ID}/css/[name].[contenthash:8].css`, + chunkFilename: `static-${BUILD_ID}/css/[name].[contenthash:8].chunk.css`, }), // Generate an asset manifest file with the following content: // - "files" key: Mapping of all asset filenames to their corresponding diff --git a/packages/react-scripts/package.json b/packages/react-scripts/package.json index b70b184fe39..cb90bafcd7c 100644 --- a/packages/react-scripts/package.json +++ b/packages/react-scripts/package.json @@ -1,10 +1,10 @@ { - "name": "react-scripts", - "version": "3.3.0", - "description": "Configuration and scripts for Create React App.", + "name": "xometry-react-scripts", + "version": "3.3.1", + "description": "Xometry configuration and scripts for Create React App.", "repository": { "type": "git", - "url": "https://github.com/facebook/create-react-app.git", + "url": "https://github.com/xometry/create-react-app.git", "directory": "packages/react-scripts" }, "license": "MIT", @@ -12,7 +12,7 @@ "node": ">=8.10" }, "bugs": { - "url": "https://github.com/facebook/create-react-app/issues" + "url": "https://github.com/xometry/create-react-app/issues" }, "files": [ "bin",