react-app-rewire-disable-chunks
v0.0.1
Published
Modifies react-scripts 2.0 config to emit a single chunk
Downloads
1,703
Readme
react-app-rewire-disable-chunks
In react-scripts
v1, your JavaScript was always compiled to a single file. In
version 2, code splitting is enabled by default, so your application will be
split into several 'chunks' which can be loaded onto the page indepedently. This
is often a good idea, especially for performance! But there are also legitimate
use cases where you need your code to be in just one file, especially when your
React app is just one portion of a larger page.
This rewiring allows you to easily customise your create-react-app
application
without having to eject it. You only need to install this package alongside
react-app-rewired
, and make a couple of changes to your package.json
.
Installation
Install required dependencies:
yarn add -D react-app-rewired react-app-rewire-disable-chunks
Edit your
package.json
scripts to usereact-app-rewired
instead ofreact-scripts
.Add this line to your
package.json
:"config-overrides-path": "node_modules/react-app-rewire-disable-chunks",
That's it! Your app should now be compiled to just /static/js/bundle.js
in dev
mode, or main.[hash].js
for production builds.