我如何拥有多个产品环境?
我在博览会(SDK36)项目中的config.js
如下所示:
import Constants from 'expo-constants';
export const { version } = Constants.manifest;
export const locales = [
'en',
'fr',
];
/* eslint-disable global-require, consistent-return, arrow-body-style */
export const getEnvVars = (env = Constants.manifest.releaseChannel) => {
let config = null;
// What is __DEV__ ?
// This variable is set to true when react-native is running in Dev mode.
// __DEV__ is true when run locally, but false when published.
if (__DEV__) { // eslint-disable-line no-undef
config = require('./env/default');
} else if (env === 'staging') {
config = require('./env/staging');
} else if (env === 'preprod') {
config = require('./env/preprod');
} else if (env === 'prod') {
config = require('./env/prod');
} else {
config = require('./env/prod');
}
if (!['prod', 'test'].includes(config.name)) {
// eslint-disable-next-line no-console
console.log('Loading', config.name, 'config');
}
return config;
};
我无法为staging
和preprod
建立网络,知道如何做吗?