- Install plugins:
yarn add mobx mobx-react react-app-rewire-mobx
yarn add --dev react-app-rewired
- Define config-overrides:
Create the file config-overrides.js
in your project's root directory with the following content:
/* config-overrides.js */
const rewireMobX = require('react-app-rewire-mobx');
module.exports = function override(config, env) {
config = rewireMobX(config, env);
return config;
}
- Rewire existing scripts:
Modify the package.json
file:
/* package.json */
"scripts": {
- "start": "react-scripts start",
+ "start": "react-app-rewired start",
- "build": "react-scripts build",
+ "build": "react-app-rewired build",
- "test": "react-scripts test --env=jsdom",
+ "test": "react-app-rewired test --env=jsdom"
}