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

Created on 3 Mar 2018  路  3Comments  路  Source: jantimon/html-webpack-plugin

Description

I'm getting Tapable.plugin is deprecated and Tapable.apply is deprecated warnings from Node 8.9.1 when using [email protected] with [email protected].

Error Message & Stack Trace

Here is the stack trace I get when running webpack with node --trace-deprecation:

(node:2332) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
    at HtmlWebpackPlugin.apply (./node_modules/html-webpack-plugin/index.js:65:14)
    at webpack (./node_modules/webpack/lib/webpack.js:37:12)
    at Promise (./lib/webpack.js:8:5)
    at new Promise (<anonymous>)
    at Object.exports.compile (./lib/webpack.js:7:10)
    at ReactBenchmark.run (./lib/index.js:50:19)
    at <anonymous>
(node:2332) DeprecationWarning: Tapable.apply is deprecated. Call apply on the plugin directly instead
    at Object.compileTemplate (./node_modules/html-webpack-plugin/lib/compiler.js:47:17)
    at compiler.plugin (./node_modules/html-webpack-plugin/index.js:67:42)
    at AsyncParallelHook.eval [as callAsync] (eval at create (./node_modules/tapable/lib/HookCodeFactory.js:24:12), <anonymous>:13:1)
    at AsyncParallelHook.lazyCompileHook [as _callAsync] (./node_modules/tapable/lib/Hook.js:35:21)
    at hooks.beforeCompile.callAsync.err (./node_modules/webpack/lib/Compiler.js:459:20)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (./node_modules/tapable/lib/HookCodeFactory.js:24:12), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook [as _callAsync] (./node_modules/tapable/lib/Hook.js:35:21)
    at Compiler.compile (./node_modules/webpack/lib/Compiler.js:452:28)
    at readRecords.err (./node_modules/webpack/lib/Compiler.js:200:11)
    at Compiler.readRecords (./node_modules/webpack/lib/Compiler.js:322:11)
    at hooks.run.callAsync.err (./node_modules/webpack/lib/Compiler.js:197:10)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (./node_modules/tapable/lib/HookCodeFactory.js:24:12), <anonymous>:6:1)
    at AsyncSeriesHook.lazyCompileHook [as _callAsync] (./node_modules/tapable/lib/Hook.js:35:21)
    at hooks.beforeRun.callAsync.err (./node_modules/webpack/lib/Compiler.js:194:19)
    at AsyncSeriesHook.eval [as callAsync] (eval at create (./node_modules/tapable/lib/HookCodeFactory.js:24:12), <anonymous>:15:1)
    at AsyncSeriesHook.lazyCompileHook [as _callAsync] (./node_modules/tapable/lib/Hook.js:35:21)

Config

Copy the relevant section from webpack.config.js:

module.exports = {
  mode: debug ? 'development' : 'production',
  context: __dirname,
  resolve: {
    alias: {
      ...
    },
  },
  entry: {
    bundle: path.join(__dirname, 'client.js'),
  },
  output: {
    path: outputPath,
    filename: '[name].js',
  },
  plugins: [new HtmlWebpackPlugin()],
  module: {
    noParse: ...
    rules: [
      ...
    ],
  },
}

Copy your template file:
Using the default template.

Environment

Node.js v8.9.1
darwin 17.4.0
yarn 1.3.2
[email protected]
[email protected]

Most helpful comment

Should be fixed in 3.0.6.

All 3 comments

Looks like 3.0 is still backwards compatible using the old plugin syntax. Maybe there should be a new major (4.0) that removes compatibility with webpack 3.

Should be fixed in 3.0.6.

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hackteck picture hackteck  路  3Comments

MatthewKosloski picture MatthewKosloski  路  3Comments

klinki picture klinki  路  3Comments

meleyal picture meleyal  路  3Comments

lonelyclick picture lonelyclick  路  3Comments