gdborton / webpack-parallel-uglify-plugin

A faster uglifyjs plugin.
466 stars 34 forks source link

DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead #58

Closed wxy1995 closed 3 years ago

wxy1995 commented 5 years ago

Hi,

I got the following warning message when building my project:

DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead

After checking out webpack dependencies (webpack, loaders, plugins, …), i found out that webpack-parallel-uglify-plugin uses compiler.plugin('xxx').

Now that webpack 4 is using a new plugin system and deprecates the previous APIs, should we update webpack-parallel-uglify-plugin? If yes, i am willing to send a PR.

Xuffy commented 5 years ago

Has the problem been solved?

wxy1995 commented 5 years ago

I just write a simple webpack plugin to ignore these warnings:

IgnoreCssOrderConflictPlugin.js:

module.exports = class IgnoreCssOrderConflictPlugin {
    apply(compiler) {
        const messageRegExp = /chunk \w+ \[mini-css-extract-plugin[^]*Conflicting order between:/
        function doneHook(stats) {
            stats.compilation.warnings = stats.compilation.warnings.filter(function(warn) {
                if (messageRegExp.test(warn.message)) {
                    return false
                }
                return true;
            })
        }
        if (compiler.hooks) {
            compiler.hooks.done.tap("IgnoreCssOrderConflictPlugin", doneHook)
        } else {
            compiler.plugin("done", doneHook)
        }
    }
}

webpack.config.js

plugins: [
    ...,
    new IgnoreCssOrderConflictPlugin(),
    ...
]
LofhJann commented 5 years ago

This should be fixed before Webpack 5 (in Alpha now, no release date set yet) since all items deprecated with Webpack 4 will be removed in that release (as mentioned in https://github.com/webpack/changelog-v5/blob/master/README.md)

gdborton commented 3 years ago

This has been updated for the 2.0.0 release.