如何在博览会中构建用于暂存和生产环境的Web应用程序?

时间:2019-12-30 05:22:11

标签: javascript reactjs react-native expo react-native-web

我如何拥有多个产品环境?

我在博览会(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;
};

我无法为stagingpreprod建立网络,知道如何做吗?

0 个答案:

没有答案