Add vendor splitting to
Add Long term caching and vendor splitting to your create-react-app via react-app-rewired.
This rewire is heavily based on the upcoming changes to create-react-app
in
this pull request
facebook/create-react-app#3145
Thanks @ayc0 for making it happen. This rewire will try to keep up to the PR, making it a drop in replacement the day the PR is accepted.
Example app using the rewire: https://github.com/andriijas/create-react-app-playground
npm install --save-dev react-app-rewire-vendor-splitting
OR
yarn add --dev react-app-rewire-vendor-splitting
In your react-app-rewired configuration:
/* config-overrides.js */
const rewireVendorSplitting = require("./react-app-rewire-vendor-splitting");
module.exports = function override(config, env) {
config = rewireVendorSplitting(config, env);
return config;
};
/* src/vendors.js */
module.exports = {
vendors: [
"prop-types",
"react",
"react-dom",
"react-router-dom",
"react-router-redux",
"react-redux",
"redux"
]
};