简体   繁体   中英

Disable babel plugin on CircleCI

I'd like to disable/not install one specific npm package in my app when CircleCI runs its tests, because the package makes the build process fail.

To be specific, it is a babel plugin for react-intl that automatically parses the files and pulls strings in another folder (babel-plugin-react-intl).

What is the best way of achieving this? Can this be done in the .babelrc file for example?

How you install and run tests locally should be the same as your CI setup.

If you need to disable a babel transform for tests - have them run as a different NODE_ENV and make sure your .babelrc only includes the plugin for the specific NODE_ENV eg:

{
  "env": {
    "production": {
      "plugins": ["react-intl"]
    }
  }
}

See: https://babeljs.io/docs/usage/babelrc/#env-option

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM