Simple Babel plugin that replaces the global `__DEV__` identifier with `process.env.NODE_ENV !== 'production'`, allowing developers to conditionally include debug-only code without runtime overhead. Version 1.0.0 is stable and final; no new releases expected. It is lightweight with zero dependencies, works with Babel 6 and 7, and is used in production by many React-based libraries. Unlike alternatives like babel-plugin-transform-inline-environment-variables or manual if-blocks, this plugin provides a single-purpose, semantic `__DEV__` syntax with no configuration required.
npm install babel-plugin-devVerified import paths — ran on the pinned version, not inferred.
Configures Babel to replace __DEV__ with process.env.NODE_ENV !== 'production' for conditional debug code.
Ensure `__DEV__` is not used as a variable name for other purposes; if you need scoped dev flags, use a different approach.
Do not reassign `__DEV__`. Use it only as a read-only global flag.
Consider using @babel/plugin-transform-inline-environment-variables for more flexibility, or manually check process.env.NODE_ENV.
Run `npm install babel-plugin-dev --save-dev` in your project root.
Add 'dev' to your Babel plugins list (e.g., in .babelrc) and ensure you are compiling the file with Babel.
Make sure to run the file through Babel before execution, e.g., using @babel/node or a build step.
No dependency data recorded yet.