Registry / devops / babel-plugin-transform-dev

babel-plugin-transform-dev

JSON →
library2.0.1jsnpmunverified

Babel v6 plugin that replaces all occurrences of __DEV__ with the evaluation of "production" !== process.env.NODE_ENV. Currently at version 2.0.1, with no recent updates. It simplifies stripping development-only code from production bundles. Unlike similar plugins, it evaluates the expression at build time, replacing __DEV__ with a boolean literal. Limited to Babel v6; unmaintained since 2018. Use @babel/plugin-transform-dotenv or custom plugins for modern Babel.

npm install babel-plugin-transform-dev
INSTALL
IMPORT
SIG · BABEL-PLUGIN-TRANS
B
babel-plugin-transform-dev
devopsjavascriptv2.0.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import plugin from 'babel-plugin-transform-dev'
const plugin = require('babel-plugin-transform-dev')
ESM import works; require also valid as this package does not enforce ESM-only.
N/A (Plugin Usage)
module.exports = { plugins: ['transform-dev'] }
module.exports = { plugins: ['babel-plugin-transform-dev'] }
Babel resolves plugin names automatically; prefix not needed in .babelrc.
N/A (Plugin Options)
module.exports = { plugins: [['transform-dev', { evaluate: false }]] }
module.exports = { plugins: ['transform-dev'], options: { evaluate: false } }
Options are passed as array elements; separate 'options' key is invalid.

Demonstrates replacing __DEV__ with a boolean based on environment variable.

// install: npm install babel-plugin-transform-dev // .babelrc { "plugins": ["transform-dev"] } // input.js const isDev = __DEV__; if (__DEV__) { console.log('dev only'); } // output (with NODE_ENV=production) const isDev = false; if (false) { console.log('dev only'); }
Debug
Known issues
breakingPackage is designed for Babel v6 only; does not work with Babel v7+.
fix
Use @babel/plugin-transform-dev or a custom plugin for Babel v7+.
affects: >=2.0.1
deprecatedLast release 2018; no active maintenance or security updates.
fix
Consider alternatives like @babel/plugin-transform-dotenv or custom babel macros.
affects: >=0.0.0
gotchaAssumes process.env.NODE_ENV is set; otherwise __DEV__ is always true.
fix
Ensure your build system defines NODE_ENV (e.g., 'production' via webpack DefinePlugin).
affects: >=0.0.0
Errors
Common errors & fixes
Plugin/transform-dev is not a valid plugin
Using with Babel v7+ which does not support this plugin.
fix
Switch to @babel/plugin-transform-dev or another alternative.
ReferenceError: __DEV__ is not defined
Plugin did not transform __DEV__ because it wasn't applied.
fix
Verify plugin is included in .babelrc and Babel is running correctly.
TypeError: Cannot read property 'evaluate' of undefined
Incorrect plugin configuration syntax in .babelrc.
fix
Use array syntax: ['transform-dev', { evaluate: false }].
Upgrade
Version history
2.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
babel-plugin-transform-dev — npm install babel-plugin-transform-dev · libregistry