vite-plugin-clear-console
v0.2.3
Published
the plugin is used to clear all console output in the production environment
Downloads
70
Readme
🚀 Introduce
The advantage of using this plugin is that there is no need to delete the relevant console of the source file for debugging in the development environment and elimination in the production environment.
📦 Installation
npm install vite-plugin-clear-console -D
yarn add vite-plugin-clear-console -D
pnpm install vite-plugin-clear-console -D
🎉 Usage
import { defineConfig } from 'vite'
import clearConsole from 'vite-plugin-clear-console'
export default defineConfig({
plugins: [
{
...clearConsole(),
apply: 'build', // build environment
},
],
})
👏 Options
exclude
You can specify excluded files so that the console corresponding to the source file is not deleted
Example:
import { defineConfig } from 'vite'
import clearConsole from 'vite-plugin-clear-console'
export default defineConfig({
plugins: [
{
...clearConsole({ exclude: ['./src/main.ts', './views/login.tsx'] }),
apply: 'build',
},
],
})
suffix
Source file suffix that should be filtered. Its default value is ['js', 'ts', 'tsx', 'jsx', 'vue']
, and you can overwrite the option.
Example:
import { defineConfig } from 'vite'
import clearConsole from 'vite-plugin-clear-console'
export default defineConfig({
plugins: [
{
...clearConsole({ suffix: ['js', 'ts', 'vue'] }),
apply: 'build',
},
],
})
inject
You can add console to your final product. And finally added to the entry file of the project for simple description.
example:www.baidu.com
For instance, you can view the playground.
License
The Vite plugin is open-sourced software licensed under the MIT license.