1.0.3 • Published 3 years ago
babel-plugin-dev-log v1.0.3
babel-plugin-dev-log
helps developers debug and log output in the development environment
Install
npm
npm install babel-plugin-dev-log
yarn
yarn add babel-plugin-dev-log
Usage
Configure the
.eslintrc.js
filemodule.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. |