Skip to content

Commit 828a8f0

Browse files
authored
Merge pull request #2 from xometry/custom-react-scripts
Custom react scripts
2 parents 18e56da + b100526 commit 828a8f0

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

packages/react-scripts/config/webpack.config.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ const getCacheIdentifier = require('react-dev-utils/getCacheIdentifier');
3838
// @remove-on-eject-end
3939
const postcssNormalize = require('postcss-normalize');
4040

41+
const BUILD_ID = process.env.REACT_APP_BUILD_ID || '';
42+
4143
const appPackageJson = require(paths.appPackageJson);
4244

4345
// Source maps are resource heavy and can cause out of memory issue for large source files.
@@ -184,14 +186,14 @@ module.exports = function(webpackEnv) {
184186
// There will be one main bundle, and one file per asynchronous chunk.
185187
// In development, it does not produce real files.
186188
filename: isEnvProduction
187-
? 'static/js/[name].[contenthash:8].js'
188-
: isEnvDevelopment && 'static/js/bundle.js',
189+
? `static-${BUILD_ID}/js/[name].[contenthash:8].js`
190+
: isEnvDevelopment && `static-${BUILD_ID}/js/bundle.js`,
189191
// TODO: remove this when upgrading to webpack 5
190192
futureEmitAssets: true,
191193
// There are also additional JS chunk files if you use code splitting.
192194
chunkFilename: isEnvProduction
193-
? 'static/js/[name].[contenthash:8].chunk.js'
194-
: isEnvDevelopment && 'static/js/[name].chunk.js',
195+
? `static-${BUILD_ID}/js/[name].[contenthash:8].chunk.js`
196+
: isEnvDevelopment && `static-${BUILD_ID}/js/[name].chunk.js`,
195197
// We inferred the "public path" (such as / or /my-project) from homepage.
196198
// We use "/" in development.
197199
publicPath: publicPath,
@@ -396,7 +398,7 @@ module.exports = function(webpackEnv) {
396398
loader: require.resolve('url-loader'),
397399
options: {
398400
limit: imageInlineSizeLimit,
399-
name: 'static/media/[name].[hash:8].[ext]',
401+
name: `static-${BUILD_ID}/media/[name].[hash:8].[ext]`,
400402
},
401403
},
402404
// Process application JS with Babel.
@@ -570,7 +572,7 @@ module.exports = function(webpackEnv) {
570572
// by webpacks internal loaders.
571573
exclude: [/\.(js|mjs|jsx|ts|tsx)$/, /\.html$/, /\.json$/],
572574
options: {
573-
name: 'static/media/[name].[hash:8].[ext]',
575+
name: `static-${BUILD_ID}/media/[name].[hash:8].[ext]`,
574576
},
575577
},
576578
// ** STOP ** Are you adding a new loader?
@@ -644,8 +646,8 @@ module.exports = function(webpackEnv) {
644646
new MiniCssExtractPlugin({
645647
// Options similar to the same options in webpackOptions.output
646648
// both options are optional
647-
filename: 'static/css/[name].[contenthash:8].css',
648-
chunkFilename: 'static/css/[name].[contenthash:8].chunk.css',
649+
filename: `static-${BUILD_ID}/css/[name].[contenthash:8].css`,
650+
chunkFilename: `static-${BUILD_ID}/css/[name].[contenthash:8].chunk.css`,
649651
}),
650652
// Generate an asset manifest file with the following content:
651653
// - "files" key: Mapping of all asset filenames to their corresponding

packages/react-scripts/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
{
2-
"name": "react-scripts",
3-
"version": "3.3.0",
4-
"description": "Configuration and scripts for Create React App.",
2+
"name": "xometry-react-scripts",
3+
"version": "3.3.1",
4+
"description": "Xometry configuration and scripts for Create React App.",
55
"repository": {
66
"type": "git",
7-
"url": "https://github.com/facebook/create-react-app.git",
7+
"url": "https://github.com/xometry/create-react-app.git",
88
"directory": "packages/react-scripts"
99
},
1010
"license": "MIT",
1111
"engines": {
1212
"node": ">=8.10"
1313
},
1414
"bugs": {
15-
"url": "https://github.com/facebook/create-react-app/issues"
15+
"url": "https://github.com/xometry/create-react-app/issues"
1616
},
1717
"files": [
1818
"bin",

0 commit comments

Comments
 (0)