Webpck Tapable.plugin is deprecated. Use new API on `.hooks` instead xxx

212 阅读1分钟

webpack npm run build 报

Webpck Tapable.plugin is deprecated. Use new API on .hooks instead xxx

原因:由于使用的webpack版本过高, 查询官网 ,看一下最新plugin的使用

最新版 uglify-js 在vue.config.js的配置如下

configureWebpack: config => {

    if (process.env.NODE_ENV === 'production') {
        //压缩js.去掉console
        config.plugins.push(
            new UglifyJsPlugin({
                uglifyOptions: {
                    compress: {
                        drop_console: true,
                        pure_funcs: ['console.log']
                    }
                },
                sourceMap: true,//映射源文件
                parallel: true,//多进程并行运行
            })
        )
    }
}

uglify-js :www.qiutianaimeili.com/html/page/2… CompressionWebpackPlugin :segmentfault.com/a/119000003…