{"id":19190,"library":"babel-plugin-transform-dev","title":"babel-plugin-transform-dev","description":"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.","status":"maintenance","version":"2.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/martinandert/babel-plugin-transform-dev","tags":["javascript","babel-plugin","transform","dev","debug"],"install":[{"cmd":"npm install babel-plugin-transform-dev","lang":"bash","label":"npm"},{"cmd":"yarn add babel-plugin-transform-dev","lang":"bash","label":"yarn"},{"cmd":"pnpm add babel-plugin-transform-dev","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM import works; require also valid as this package does not enforce ESM-only.","wrong":"const plugin = require('babel-plugin-transform-dev')","symbol":"default","correct":"import plugin from 'babel-plugin-transform-dev'"},{"note":"Babel resolves plugin names automatically; prefix not needed in .babelrc.","wrong":"module.exports = { plugins: ['babel-plugin-transform-dev'] }","symbol":"N/A (Plugin Usage)","correct":"module.exports = { plugins: ['transform-dev'] }"},{"note":"Options are passed as array elements; separate 'options' key is invalid.","wrong":"module.exports = { plugins: ['transform-dev'], options: { evaluate: false } }","symbol":"N/A (Plugin Options)","correct":"module.exports = { plugins: [['transform-dev', { evaluate: false }]] }"}],"quickstart":{"code":"// install: npm install babel-plugin-transform-dev\n// .babelrc\n{\n  \"plugins\": [\"transform-dev\"]\n}\n\n// input.js\nconst isDev = __DEV__;\nif (__DEV__) {\n  console.log('dev only');\n}\n\n// output (with NODE_ENV=production)\nconst isDev = false;\nif (false) {\n  console.log('dev only');\n}","lang":"javascript","description":"Demonstrates replacing __DEV__ with a boolean based on environment variable."},"warnings":[{"fix":"Use @babel/plugin-transform-dev or a custom plugin for Babel v7+.","message":"Package is designed for Babel v6 only; does not work with Babel v7+.","severity":"breaking","affected_versions":">=2.0.1"},{"fix":"Consider alternatives like @babel/plugin-transform-dotenv or custom babel macros.","message":"Last release 2018; no active maintenance or security updates.","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"Ensure your build system defines NODE_ENV (e.g., 'production' via webpack DefinePlugin).","message":"Assumes process.env.NODE_ENV is set; otherwise __DEV__ is always true.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Switch to @babel/plugin-transform-dev or another alternative.","cause":"Using with Babel v7+ which does not support this plugin.","error":"Plugin/transform-dev is not a valid plugin"},{"fix":"Verify plugin is included in .babelrc and Babel is running correctly.","cause":"Plugin did not transform __DEV__ because it wasn't applied.","error":"ReferenceError: __DEV__ is not defined"},{"fix":"Use array syntax: ['transform-dev', { evaluate: false }].","cause":"Incorrect plugin configuration syntax in .babelrc.","error":"TypeError: Cannot read property 'evaluate' of undefined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}