vue3+vite build打包删除控制台打印

很简单,直接在vite.config.ts里面添加配置即可:

export default ({ mode }) => defineConfig({
  build: {
    minify: "terser", 
    terserOptions: {
      compress: {
          //生产环境时移除console
          drop_console: true,
          drop_debugger: true,
      },
  }
	}
})

此处我只给了build的配置,其他的配置需要自己去添加

posted @ 2023-05-25 11:33  骚年上天不?  阅读(396)  评论(0编辑  收藏  举报