easily impliment must-have rewires to supercharge your CRA-based project
- customize via
.babelrc
.eslintrc
.stylelintrc
- inlining of your main bundle (code-splitting friendly)
- standard image compression
- lighthouse-oriented manifest generation
- whitelist un-precompiled libs (avoid nasty minification errors)
# with npm
$ npm install -D ideal-rewires
Make sure you've also installed the latest version of react-app-rewired
const rewire = require('ideal-rewires').default
// in this instance, all we want is to use a `.babelrc` file
const options = { babelrc: true }
module.exports = rewire(options)
The object that you pass to rewire()
Whether to look for & (if present) use a .babelrc
file
Whether to look for & (if present) use a .eslintrc
file
Whether to look for & (if present) use a .stylelintrc
file
Used to generate the manifest.json
on build
Customize dev server headers (for instance, if you use an authentication API that requests your app's manifest)
Whitelist un-precompiled libraries for compilation and avoid the following error (documented here):
Failed to minify the code from this file
This can be particularly helpful if you're directly or indirectly using the bitcoinjs-lib. Here's an example of this option's usage:
config-overrides.js
const rewire = require('ideal-rewires').default
module.exports = rewire({
whitelist: [
'bitcoinjs-lib',
'tiny-secp256k1/ecurve',
'base64url/dist/base64url',
'base64url/dist/pad-string',
'bip32',
].map(module => `node_modules/${module}`),
})