发布于 3年前
uniapp 打包上线后看不到 console.log日志,如何开启
打开 vue.config.js
,把 drop_console
和drop_debugger
改为 false 后,重新打包上线即可看到console.log日志
module.exports = {
productionSourceMap: false, // 生产打包时不输出map文件,增加打包速度
configureWebpack: config => {
if (process.env.NODE_ENV === 'production') {
config.optimization.minimizer[0].options.terserOptions.compress.warnings = false
config.optimization.minimizer[0].options.terserOptions.compress.drop_console = false
config.optimization.minimizer[0].options.terserOptions.compress.drop_debugger = false
config.optimization.minimizer[0].options.terserOptions.compress.pure_funcs = ['console.log']
}
}
}