
获得徽章 8
赞了这篇文章
赞了这篇文章
赞了这篇文章
赞了这篇文章
赞了这篇文章
赞了这篇沸点
vuecli生成的项目 uniapp+vue3+vite模式下 打包生成h5时,大佬们有遇到过配置编译去除注释,没被注释的情况吗,大佬们有什么解决方案
build: {
//打包环境移除console.log,debugger
minify: 'terser',
terserOptions: {
format: {
// 去除注释
comments: false,
},
compress: {
warnings: false,
drop_console: true, // console
drop_debugger: true,
// directives: true,
// dead_code: true,
pure_funcs: ['console.log'], // 移除console
},
},
//打包文件按照类型分文件夹显示
rollupOptions: {
input: {
main: path.resolve(__dirname, 'index.html'),
},
output: {
chunkFileNames: 'js/[name]-[hash].js',
entryFileNames: 'js/[name]-[hash].js',
assetFileNames: '[ext]/[name]-[hash].[ext]',
},
},
},
build: {
//打包环境移除console.log,debugger
minify: 'terser',
terserOptions: {
format: {
// 去除注释
comments: false,
},
compress: {
warnings: false,
drop_console: true, // console
drop_debugger: true,
// directives: true,
// dead_code: true,
pure_funcs: ['console.log'], // 移除console
},
},
//打包文件按照类型分文件夹显示
rollupOptions: {
input: {
main: path.resolve(__dirname, 'index.html'),
},
output: {
chunkFileNames: 'js/[name]-[hash].js',
entryFileNames: 'js/[name]-[hash].js',
assetFileNames: '[ext]/[name]-[hash].[ext]',
},
},
},
展开
17
30
赞了这篇文章
赞了这篇文章
赞了这篇文章
赞了这篇文章