Remove Console
Automatically removes [log|warn|error|info|debug]
and debugger
statements from build artifacts in production mode.
Setup
- Install the plugin
bash
$ npm add @winner-fed/plugin-remove-console -D
bash
$ yarn add @winner-fed/plugin-remove-console -D
bash
$ pnpm add @winner-fed/plugin-remove-console -D
bash
$ bun add @winner-fed/plugin-remove-console -D
- Enable the plugin in the
.winrc
configuration file
ts
import { defineConfig } from 'win';
export default defineConfig({
plugins: [require.resolve('@winner-fed/plugin-remove-console')],
removeConsole: {}
});
Configuration
js
removeConsole({
// don't remove console.([log|warn|error|info|debug]) and debugger these module
external: [],
// remove console type of these module
// enum: ['log', 'warn', 'error', 'info', 'debug']
consoleType: ['log'],
// filters for transforming targets
include: [/\.[jt]sx?$/, /\.vue\??/],
exclude: [/node_modules/, /\.git/],
})