babel-plugin-dev-log
v1.0.3
Published
A babel plugin to help log output and debugging in the development environment
Readme
babel-plugin-dev-log
helps developers debug and log output in the development environment
Install
npm
npm install babel-plugin-dev-logyarn
yarn add babel-plugin-dev-logUsage
Configure the
.eslintrc.jsfilemodule.exports = { // Omit other configuration items globals: { __DEV__: true } }The Babel configuration file(such as
.babelrc.js)module.exports = { // Omit other configuration items plugins: [['dev-log']] }Output in the project
if (__DEV__) { console.log("This log is printed only in the development environment. Production ignores if(__DEV__){...} block") }
Options
| Name | Type | Default | Description |
| ---------------------- | ----------- | --------------------------------------- | ------------------------------------------------------------ |
| customIdentifier | {String} | __DEV__ | Use a custom identifier. notes: The key value of the globals option in the .eslintrc.js file should be the same as the custom identifier. |
| isProd | {Boolean} | process.env.NODE_ENV === "production" | When isProd is true, remove if(__DEV__){...} block. Most applications are in the package build phase. |
