Skip to content

DeprecationWarning: Tapable.plugin is deprecated. Webpack 4 #38

@WaqasIbrahim

Description

@WaqasIbrahim

Hi, When using Webpack 4 I receive the following warning message:

DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
    at WebpackObfuscator.apply (../../node_modules/webpack-obfuscator/index.js:16:18)

The warning can be fixed by using the new hooks API and replacing

compiler.plugin('compilation', function (compilation) {
    compilation.plugin("optimize-chunk-assets", function (chunks, callback) {

With this:

compiler.hooks.compilation.tap('WebpackObfuscator', function (compilation) {
    compilation.hooks.optimizeChunkAssets.tap('WebpackObfuscator', function (chunks) {

And removing the callback call. You can also keep backwards compatibility. Please take a look at my commit here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions