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-configtestapautsdxvoluptatesporrogrids-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-coreforeach-tsdx@techstack/tcm-clidts-clieasy-scriptsdskcorenewes-react-bridgeenact-deveslint-config-mbullingtonex-ikon-components-library@4c/babel-preset@4c/babel-preset-4catalyzer@abdulkaderptp/tsdx@prismify/tsdx@projectbabelfish/defikingdoms-sdk@bluelovers/tsdx@chance/tsdx@bezael-challenge/innoit-date-format@bhzdbash/utils@behzadebrhm/utils@breakinferno/tsdxfcandlelabssdkcenco-loyalty-componentscfb-cms-democreate-scooper-comcra-template-levelcotrader-dex-sdkcosmic-react-ssocra-template-react-acedataormcscg-product-carddip-webpack-config@asheswook/react-router@ali-i18n-fe/dada-cli@ali-i18n-fe/dada-component@ambroseus/tsdx@autoguru/babel-presetsushi-sdk-ftmstub-city
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