0.2.3 • Published 8 months ago

vite-plugin-clear-console v0.2.3

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

🚀 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

  1. 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',
    },
  ],
})
  1. 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',
    },
  ],
})
  1. 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.

0.2.3

8 months ago

0.2.1

2 years ago

0.2.2

1 year ago

0.2.0

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.0

2 years ago