Skip to content

A vite plugin that deletes console.log and related methods in the production environment

License

Notifications You must be signed in to change notification settings

Evertt/vite-plugin-remove-console

 
 

Repository files navigation

vite-plugin-remove-console

Delete the vite plugin of console.log in the production environment

NPM version NPM Downloads

English | 简体中文

🚀 Features

  • High precision, zero intrusion: Accurately and complete remove console.log in the code, currently supports 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: Support passing external, which means that some files do not delete console.log, for example: removeConsole({ external: ["src/assets/iconfont/iconfont.js", ...] })

📦 install

npm install vite-plugin-remove-console -D
or
pnpm add vite-plugin-remove-console -D

🦄 Usage

  • vite.config.ts
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import removeConsole from 'vite-plugin-remove-console';

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    removeConsole()
  ]
});

Refer to more examples

License

MIT © xiaoxian521-2022

About

A vite plugin that deletes console.log and related methods in the production environment

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 91.2%
  • JavaScript 8.8%