I'm working on a project using both react-web and react-native(mixed app). I was able to set environment variables using cross-env on web, but this seems not working with react-native.
Meaning:
npm script
cross-env NODE_ENV=development BABEL_ENV=development_web webpack-dev-server --hot --progress --config build/webpack.config.dev.js
works fine.but
cross-env NODE_ENV=development BABEL_ENV=development_rn && react-native run-ios
won't work!
I got two different BABEL_ENV env settings for .babelrc
:
{
"env": {
"development_web": {
"presets": ["react", "es2015", "stage-0"],
"plugins": [
[
"react-transform",
{
"transforms": [
{
"transform": "react-transform-hmr",
"imports": ["react"],
"locals": ["module"]
}, {
"transform": "react-transform-catch-errors",
"imports": ["react", "redbox-react"]
}
]
}
],
["import", { "style": "css", "libraryName": "antd-mobile" }],
["transform-decorators-legacy"]
]
},
"development_rn": {
"presets": ["react-native"],
"plugins": [["import", { "libraryName": "antd-mobile" }]]
},
}
}
How can I appoint NODE_ENV/BABEL_ENV to development_rn
for react native?