Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Rowno opened this issue Mar 2, 2018 · 3 comments

Comments

@Rowno
Copy link

Rowno commented Mar 2, 2018

Description

I'm getting Tapable.plugin is deprecated and Tapable.apply is deprecated warnings from Node 8.9.1 when using html-webpack-plugin@3.0.4 with webpack@4.0.1.

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
webpack@4.0.1
html-webpack-plugin@3.0.4
@yyx990803
Copy link
Contributor

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.

@jantimon
Copy link
Owner

jantimon commented Mar 6, 2018

Should be fixed in 3.0.6.

@lock
Copy link

lock bot commented May 31, 2018

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.

@lock lock bot locked as resolved and limited conversation to collaborators May 31, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants