0.2.3 • Published 4 years ago

babel-plugin-dev-expression v0.2.3

Weekly downloads
85,615
License
MIT
Repository
github
Last release
4 years ago

babel-plugin-dev-expression npm version

A mirror of Facebook's dev-expression Babel plugin.

This plugin reduces or eliminates development checks from production code.

__DEV__

Replaces

__DEV__

with

process.env.NODE_ENV !== 'production'

Note: The dev-expression transform does not run when NODE_ENV is test. As such, if you use __DEV__, you will need to define it as a global constant in your test environment.

invariant

Replaces

invariant(condition, argument, argument);

with

if (!condition) {
  if ("production" !== process.env.NODE_ENV) {
    invariant(false, argument, argument);
  } else {
    invariant(false);
  }
}

Recommended for use with https://github.com/zertosh/invariant or smaller https://github.com/alexreardon/tiny-invariant.

warning

Replaces

warning(condition, argument, argument);

with

if ("production" !== process.env.NODE_ENV) {
  warning(condition, argument, argument);
}

Recommended for use with https://github.com/r3dm/warning or smaller https://github.com/alexreardon/tiny-warning.

tsdx-extraisotone-preset-reactbabel-preset-react-native-web-exporeactcloud-dev-serverreactcloud-webpackgql_din_modbabel-preset-hiroelectron-react-toolseparts-shared-uicra-template-smart@infinitebrahmanuniverse/nolb-babel-plugin-doerlikon-toolsexport-tsexpand-react-bridge@everything-registry/sub-chunk-1201@leijingdao/tsdxwebchexm-uixm-webpack-configtestapautsdxvoluptatesporro@percent/percent-api-hooksgrids-over-polygonlib-creatorlujcylynn-bootmama-exporter@webalt/react@wfp/babel-preset-wfp@weiran.zsd/tsdx@valy/tsd@wanglihua/babel-preset-react-app@un/babel-preset-wfp@thinkincoin-libs/token-lists@tszip/legacy@tszip/tszip@torswap/tor-token-lists@traitsniper/web3-react-connector@traitsniper/web3-react-v6-connector@vinceau/tsdx@useweb3/tsdx@xswap/token-lists@zalastax/nolb-babel-plugin-d@yuyi919/build-tools@zh0st/evm-chains@zerico/rollup-script@zumper/babel-preset-react-appbabel-preset-momentbabel-preset-optimisebabel-preset-packezbabel-preset-ts-libbabel-preset-yoctolbabel-presets-react-productionbabel-preset-jasonbabel-preset-enactaxonv2sdkastra-ufo-sdkant-design-draggable-modal-4ant-design-draggable-modal-fixant-design-draggable-modal-fix-2async-busbackend-testing-core@gomah/tsdx@abdulkaderptp/tsdx@4c/babel-preset@4c/babel-preset-4catalyzer@commercetools-frontend/babel-preset-mc-app@ali-i18n-fe/dada-cli@ali-i18n-fe/dada-component@copart/ops-app-frame@copart/ops-local-storage@copart/babel-preset-ops-core@copart/g2-ops-server@copart/lot-search-components@ambroseus/tsdxsushi-sdk-ftmstub-citystub-villagesurfwaxttsdx@anolilab/babel-preset@behzadebrhm/utils@bezael-challenge/innoit-date-format@bluelovers/tsdx@bhzdbash/utils@breakinferno/tsdxf@chance/tsdxtsdxtsdx-esmtsdx-sasstsdx-with-svgtsdx2tsdxwtsdyts3x@laconic/rollup-script@kiwicom/babel-preset@lgfe/ls-template-cli-babel-preset@lgfe/ls-template-cli-rollup-script
0.2.3

4 years ago

0.2.2

6 years ago

0.2.1

10 years ago

0.2.0

10 years ago

0.1.0

10 years ago