Create React App
Many applications do not require this plugin. Unless you have been directed here by other documentation, you can probably skip these instructions. See “Should I install the plugin?” for more information.
These instructions are for apps created with Create React App that have not been ejected. If you have ejected your app, please see these instructions.
Check your package.json for the version of react-scripts you are using. If it’s 1.x or 2.x, you
will need to upgrade to version 3.x for these instructions to work.
Install dependencies
We’ll be using Customize CRA (and its dependency
react-app-rewired) to add the plugin:- npm
- Yarn
- pnpm
npm install --save-dev mightymeld customize-cra react-app-rewiredyarn add --dev mightymeld customize-cra react-app-rewiredpnpm add --save-dev mightymeld customize-cra react-app-rewiredCreate a new start script that will be used just for MightyMeld:
package.json{
...
"scripts": {
"start": "react-scripts start",
"start:mightymeld": "react-app-rewired start", // make sure to include any flags from your original start command e.g. --open-ssl-legacy-provider
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
...
}Create a
config-overrides.jsfile next to yourpackage.jsonfile:config-overrides.jsconst { addBabelPlugins, override } = require('customize-cra');
module.exports = override(...addBabelPlugins('mightymeld/babel-plugin-mightymeld'));Update the
runentry in yourmightymeld.jsonfile as follows:mightymeld.json{
...
"run": "npm run start:mightymeld", // Adjust if you use yarn, pnpm, etc.
...
}