Other Frameworks
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 will work if you have ejected from Create React App.
Start by installing the mightymeld
package in your project:
- npm
- Yarn
- pnpm
npm install --save-dev mightymeld
yarn add --dev mightymeld
pnpm add --save-dev mightymeld
Then, follow the directions below.
If you DO NOT have a babel.config.js
file
Create a babel.config.js
file in the root of your project:
const babel = {};
if (process.env.MIGHTYMELD) {
babel.plugins = ['mightymeld/babel-plugin-mightymeld'];
}
module.exports = babel;
If you have a babel.config.js
file
If your existing config file looks like this:
module.exports = {
presets: [...],
plugins: [...]
};
First use a variable to store the config so you can modify if conditionally:
const babel = {
presets: [...],
plugins: [...]
};
module.exports = babel;
Then add the MightyMeld plugin:
const babel = {
presets: [...],
plugins: [...]
};
if (process.env.MIGHTYMELD) {
babel.plugins.push('mightymeld/babel-plugin-mightymeld');
}
module.exports = babel;
If you have a babel.config.json
or .babelrc.json
file
First convert your existing file from JSON to JavaScript so you can make the conditional check for
MIGHTYMELD
.
If your existing config file looks like this:
{
"presets": [...],
"plugins": [...]
}
Convert it to JavaScript like this:
const babel = {
presets: [...],
plugins: [...]
};
module.exports = babel;
Then add the MightyMeld plugin:
const babel = {
presets: [...],
plugins: [...]
};
if (process.env.MIGHTYMELD) {
babel.plugins.push('mightymeld/babel-plugin-mightymeld');
}
module.exports = babel;
If your framework does not use Babel, or does not recognize the babel.config.js
file
We have experience setting up MightyMeld on other frameworks such as Umi. If you are using a framework for which you don’t see instructions here, please contact us and we’ll help you get set up.