Last active
March 9, 2021 11:26
-
-
Save simpixelated/90a3c16c3ed268fe24f5e5c9585ced2f to your computer and use it in GitHub Desktop.
Disable Code Splitting (and caching) In Create React App
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const rewire = require('rewire'); | |
const defaults = rewire('react-scripts/scripts/build.js'); | |
let config = defaults.__get__('config'); | |
config.optimization.splitChunks = { | |
cacheGroups: { | |
default: false, | |
}, | |
}; | |
config.optimization.runtimeChunk = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"start": "node ./scripts/start-non-split.js", | |
"build": "node ./scripts/build-non-split.js", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const rewire = require('rewire'); | |
const defaults = rewire('react-scripts/scripts/start.js'); | |
let configFactory = defaults.__get__('configFactory'); | |
defaults.__set__('configFactory', (env) => { | |
const config = configFactory(env); | |
config.optimization.splitChunks = { | |
cacheGroups: { | |
default: false, | |
}, | |
}; | |
config.optimization.runtimeChunk = false; | |
return config; | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@Abraham-william I haven't had time to maintain this, so there may have been updates to create-react-app that need to be accounted for. Please check this issue: facebook/create-react-app#5306