A vite plugin for clearing the consoles
pnpm add vite-plugin-clear-consoles -D
// or yarn add vite-plugin-clear-consoles -D
// or npm install vite-plugin-clear-consoles --save-dev
import { defineConfig } from 'vite'
import ViteClearConsolePlugin from 'vite-plugin-clear-consoles'
export default defineConfig({
plugins: [
ViteClearConsolePlugin() // default only clear console.log()
],
// other configs
})
This plugin automatically filter the consoles in node_modules files. That means this plugin cannot clear the consoles in node_modules.
import { defineConfig } from 'vite'
import ViteClearConsolePlugin from 'vite-plugin-clear-consoles'
export default defineConfig({
plugins: [
ViteClearConsolePlugin({
consoleType: ['error', 'warn']
})
],
// other configs
})