Skip to content

Instantly share code, notes, and snippets.

@ajhyndman
Created June 15, 2020 22:11
Show Gist options
  • Select an option

  • Save ajhyndman/9643df64741e00c9a929d0eeeccc06ef to your computer and use it in GitHub Desktop.

Select an option

Save ajhyndman/9643df64741e00c9a929d0eeeccc06ef to your computer and use it in GitHub Desktop.
Patch create-react-app to support configuration extensions
diff --git a/node_modules/react-scripts/config/webpack.config.js b/node_modules/react-scripts/config/webpack.config.js
index 25840d9..b5e210f 100644
--- a/node_modules/react-scripts/config/webpack.config.js
+++ b/node_modules/react-scripts/config/webpack.config.js
@@ -36,6 +36,7 @@ const typescriptFormatter = require('react-dev-utils/typescriptFormatter');
const getCacheIdentifier = require('react-dev-utils/getCacheIdentifier');
// @remove-on-eject-end
const postcssNormalize = require('postcss-normalize');
+const extendConfig = require('../../../webpack.config.extend')
const appPackageJson = require(paths.appPackageJson);
@@ -138,7 +139,7 @@ module.exports = function(webpackEnv) {
return loaders;
};
- return {
+ return extendConfig({
mode: isEnvProduction ? 'production' : isEnvDevelopment && 'development',
// Stop compilation early in production
bail: isEnvProduction,
@@ -715,5 +716,5 @@ module.exports = function(webpackEnv) {
// Turn off performance processing because we utilize
// our own hints via the FileSizeReporter
performance: false,
- };
+ }, env, { paths });
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment