vite-plugin-remove-console
A vite plugin that remove all the specified console types in the production environment
English | 简体中文
🚀 Features
- ⚡ High precision, zero intrusion: Accurately and completely remove the
console
type specified in the code, and currently support the removal of file formats .js
, .ts
, .jsx
, .tsx
, .vue
, .svelte
- 🧪 Perfect example: Currently we have added
preact-js
, preact-ts
, react-js
, react-ts
, solid-js
, solid-ts
, svelte-js
, svelte-ts
, vue-js
, vue-ts
examples to the playgrounds folder, zero usage cost - 🦾 Configurable: Supported to pass
external
to represent certain files not to delete the specified console
type of operation, such as this: removeConsole({ external: ["src/assets/iconfont/iconfont.js", ...] })
, supports passing includes
to specify the type of console
that needs to be removed, for example like this: removeConsole({ includes: ["log", "warn", "error", "info", ...] })
, If includes
is not passed, console.log
will be removed by default
📦 install
npm install vite-plugin-remove-console -D
or
pnpm add vite-plugin-remove-console -D
🦄 Usage
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import removeConsole from "vite-plugin-remove-console";
export default defineConfig({
plugins: [vue(), removeConsole()]
});
Refer to more examples
License
MIT © xiaoxian521-latest