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

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

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

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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章