Skip to content

Instantly share code, notes, and snippets.

@jaredpalmer
Created May 26, 2020 14:46
Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaredpalmer/d3016701589f14df8a3572df91a5754b to your computer and use it in GitHub Desktop.
Save jaredpalmer/d3016701589f14df8a3572df91a5754b to your computer and use it in GitHub Desktop.
Speed up Create React App with TypeScript in development
diff --git a/node_modules/react-scripts/config/webpack.config.js b/node_modules/react-scripts/config/webpack.config.js
index 25840d9..25c3c41 100644
--- a/node_modules/react-scripts/config/webpack.config.js
+++ b/node_modules/react-scripts/config/webpack.config.js
@@ -172,7 +172,7 @@ module.exports = function(webpackEnv) {
// The build folder.
path: isEnvProduction ? paths.appBuild : undefined,
// Add /* filename */ comments to generated require()s in the output.
- pathinfo: isEnvDevelopment,
+ pathinfo: false,
// There will be one main bundle, and one file per asynchronous chunk.
// In development, it does not produce real files.
filename: isEnvProduction
@@ -270,10 +270,14 @@ module.exports = function(webpackEnv) {
// Automatically split vendor and commons
// https://twitter.com/wSokra/status/969633336732905474
// https://medium.com/webpack/webpack-4-code-splitting-chunk-graph-and-the-splitchunks-optimization-be739a861366
- splitChunks: {
+ splitChunks: isEnvDevelopment ? false : {
chunks: 'all',
name: false,
},
+ removeAvailableModules: isEnvDevelopment && false,
+ removeEmptyChunks: isEnvDevelopment && false,
+
+
// Keep the runtime chunk separated to enable long term caching
// https://twitter.com/wSokra/status/969679223278505985
// https://github.com/facebook/create-react-app/issues/5358
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment