vue3+vite build打包刪除控制檯打印

很簡單,直接在vite.config.ts裏面添加配置即可:

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

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

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