Pup

v2.x

Settings & Configuration.babelrc

The .babelrc file in Pup is a configuration file for the Babel compiler, used behind the scenes in Meteor. This file tells Babel what plugins and presets it should use when it compiles our code.

Technically, Meteor provides this file for us. We add it manually in Pup because we need to disclose usage of the lodash plugin.

Additionally, because unit and integration tests in Pup are written in ES6 JavaScript using Jest, when running tests, we need to do so using the babel-jest package. When tests run, if Jest sees a .babelrc file, it automatically uses that to configure Babel. Because Meteor's .babelrc is unexposed, we can't benefit from its usage of the babel-preset-env configuration in this environment and need to load it manually to avoid errors in Jest.

/.babelrc
{
  "plugins": [
    "lodash"
  ],
  "presets": [
    ["@babel/preset-env"],
    ["@babel/preset-react"]
  ]
}