Skip to content

Instantly share code, notes, and snippets.

@simplay
Last active May 24, 2018 16:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simplay/bfb1d293b5cb241ad17bfcad90ddeee7 to your computer and use it in GitHub Desktop.
Save simplay/bfb1d293b5cb241ad17bfcad90ddeee7 to your computer and use it in GitHub Desktop.

Enable mobx' annotations in es6

  1. Install plugins:

yarn add mobx mobx-react react-app-rewire-mobx

yarn add --dev react-app-rewired

  1. 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;
}
  1. 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"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment