vue项目打包时关闭console.log的输出

1.npm i uglifyjs-webpack-plugin -D下载所需要的依赖

2.在vue.config.js中引入

   const UglifyJsPlugin = require('uglifyjs-webpack-plugin');

3.module.exports = {

     configureWebpack:{

        optimization:{

            minimizer:[

                new UglifyJsPlugin({

                    uglifyOptions:{

                        warnings:false,

                        compress:{

                            pure_funcs: ['console.log','console.debug']

                        }

                    }

                })]

            }

    }

}

你可能感兴趣的:(vue项目打包时关闭console.log的输出)