1.0.6 • Published 4 months ago

console-hide v1.0.6

Weekly downloads
-
License
ISC
Repository
-
Last release
4 months ago

hide-console-output

一个用于移除代码中 console 输出的 Vite 插件。

安装

npm install hide-console-output

使用

在 vite.config.ts 中添加插件:

import removeConsolePlugin from "hide-console-output";

export default defineConfig({
  plugins: [
    removeConsolePlugin({
      include: /\.(js|ts|jsx|tsx)$/, // 默认匹配的文件类型
      exclude: /node_modules/, // 默认排除的文件
      methods: ["log", "warn", "error", "info", "debug"], // 默认移除的 console 方法
      environments: ["production", "prod", "pro"], // 默认在生产环境生效
    }),
  ],
});

选项

选项类型默认值描述
includestring/\.(js | ts | jsx | tsx)$/匹配的文件类型
excludestringnode_modules排除的文件
methodsstring[]["log", "warn", "error", "info", "debug"]移除的 console 方法
environmentsstring[]["production", "prod", "pro"]生效的环境
1.0.6

4 months ago

1.0.5

4 months ago

1.0.4

4 months ago

1.0.3

4 months ago

1.0.2

4 months ago

1.0.1

4 months ago