I'm working on a React Native project and I use Jenkins CI to generate Android production builds. My CI configuration first uses the following command to install dependencies before proceeding to generating a JS Bundle and passing that to Android Build:
npm install --production
I also recently updated my React Native version to 0.57.4 , after which I also needed to switch to the metro-react-native-babel-preset
(v0.49.1
). I added that to my devDependencies
in package.json
and also updated my .babelrc like so:
{
"presets": [
"module:metro-react-native-babel-preset"
],
...
}
(as stated here: https://github.com/facebook/metro/tree/master/packages/metro-react-native-babel-preset)
Since then, the task on the CI server fails (but on my local machine its fine), saying Error: Cannot find module 'metro-react-native-babel-preset'
since the preset is added to devDependencies
and the --production
stops npm
from installing any devDependencies
(as stated here - "https://docs.npmjs.com/cli/install" - "With the --production flag (or when the NODE_ENV environment variable is set to production), npm will not install modules listed in devDependencies").
Should I add the preset in the dependencies
, change my CI config or is there something different I should do?
Until now the default configuration, i.e:
{
"presets": [
"react-native"
],
...
}
worked fine, but after the React Native update, I started getting errors.