Sha256: 7b5d9da0ec86ff87f5f14965b5947236fddf47960cc8600822f716b0a9d9c2b2

Contents?: true

Size: 1.19 KB

Versions: 21

Compression:

Stored size: 1.19 KB

Contents

module.exports = function (api) {
  var validEnv = ["development", "test", "production"];
  var currentEnv = api.env();
  var isDevelopmentEnv = api.env("development");
  var isProductionEnv = api.env("production");
  var isTestEnv = api.env("test");

  if (!validEnv.includes(currentEnv)) {
    throw new Error(
      "Please specify a valid `NODE_ENV` or " +
        '`BABEL_ENV` environment variables. Valid values are "development", ' +
        '"test", and "production". Instead, received: ' +
        JSON.stringify(currentEnv) +
        "."
    );
  }

  return {
    presets: [
      isTestEnv && [
        "@babel/preset-env",
        {
          targets: { node: "current" },
          modules: "commonjs",
        },
        "@babel/preset-react",
      ],
      (isProductionEnv || isDevelopmentEnv) && [
        "@babel/preset-env",
        {
          forceAllTransforms: true,
          useBuiltIns: "entry",
          corejs: 3,
          modules: false,
          exclude: ["transform-typeof-symbol"],
        },
      ],
      [
        "@babel/preset-react",
        {
          development: isDevelopmentEnv || isTestEnv,
          useBuiltIns: true,
        },
      ],
    ].filter(Boolean),
  };
};

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
neeto-commons-backend-1.0.109 babel.config.js
neeto-commons-backend-1.0.108 babel.config.js
neeto-commons-backend-1.0.107 babel.config.js
neeto-commons-backend-1.0.106 babel.config.js
neeto-commons-backend-1.0.105 babel.config.js
neeto-commons-backend-1.0.104 babel.config.js
neeto-commons-backend-1.0.103 babel.config.js
neeto-commons-backend-1.0.102 babel.config.js
neeto-commons-backend-1.0.101 babel.config.js
neeto-commons-backend-1.0.100 babel.config.js
neeto-commons-backend-1.0.99 babel.config.js
neeto-commons-backend-1.0.98 babel.config.js
neeto-commons-backend-1.0.97 babel.config.js
neeto-commons-backend-1.0.96 babel.config.js
neeto-commons-backend-1.0.95 babel.config.js
neeto-commons-backend-1.0.94 babel.config.js
neeto-commons-backend-1.0.93 babel.config.js
neeto-commons-backend-1.0.92 babel.config.js
neeto-commons-backend-1.0.91 babel.config.js
neeto-commons-backend-1.0.90 babel.config.js