ARTICLE DETAIL

建站实战干货

来自一线的建站与推广经验沉淀,每一条都经过真实交付验证。

配置vite项目打包控制台不显示console.log配置

2026/8/16 8:34:03 拓冰建站 浏览量
配置vite项目打包控制台不显示console.log配置

可以看vite官方的配置文档:构建选项 | Vite 官方中文文档

主要是配置:但是terser需要vite3.0以后手动安装一下

    build: {sourcemap: false,minify: 'terser',terserOptions: {compress: {drop_console: true,drop_debugger: true,},},},

 安装命令:

npm install terser

然后打包就可以了