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

Deprecation Warning with MainTemplate after webpack 5 update #1408

Closed
bartdominiak opened this issue Apr 20, 2020 · 4 comments
Closed

Deprecation Warning with MainTemplate after webpack 5 update #1408

bartdominiak opened this issue Apr 20, 2020 · 4 comments

Comments

@bartdominiak
Copy link
Contributor

bartdominiak commented Apr 20, 2020

Expected behaviour

Clean output without deprecation warning

Current behaviour

After webpack update (from v4 to v5) I'm getting deprecation warnings in my console

node --trace-deprecation node_modules/.bin/webpack-cli --progress --config ./config --env dev

Output:

10% building
webpack is watching the files…

(node:78415) [DEP_WEBPACK_MAIN_TEMPLATE_GET_ASSET_PATH] DeprecationWarning: MainTemplate.getAssetPath is deprecated (use Compilation.getAssetPath instead)
    at /Users/bartek/Sites/private/vue-starter/node_modules/html-webpack-plugin/lib/child-compiler.js:163:41
    at Array.map (<anonymous>)
    at extractHelperFilesFromCompilation (/Users/bartek/Sites/private/vue-starter/node_modules/html-webpack-plugin/lib/child-compiler.js:162:45)
    at /Users/bartek/Sites/private/vue-starter/node_modules/html-webpack-plugin/lib/child-compiler.js:113:13
    at /Users/bartek/Sites/private/vue-starter/node_modules/webpack/lib/Compiler.js:450:11
    at /Users/bartek/Sites/private/vue-starter/node_modules/webpack/lib/Compiler.js:922:16
    at Hook.eval [as callAsync] (eval at create (/Users/bartek/Sites/private/vue-starter/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:4:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/bartek/Sites/private/vue-starter/node_modules/webpack/node_modules/tapable/lib/Hook.js:18:14)
    at /Users/bartek/Sites/private/vue-starter/node_modules/webpack/lib/Compiler.js:918:32
    at Hook.eval [as callAsync] (eval at create (/Users/bartek/Sites/private/vue-starter/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:4:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/bartek/Sites/private/vue-starter/node_modules/webpack/node_modules/tapable/lib/Hook.js:18:14)
    at /Users/bartek/Sites/private/vue-starter/node_modules/webpack/lib/Compilation.js:1689:41
    at /Users/bartek/Sites/private/vue-starter/node_modules/webpack/lib/HookWebpackError.js:69:3
    at Hook.eval [as callAsync] (eval at create (/Users/bartek/Sites/private/vue-starter/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:4:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/bartek/Sites/private/vue-starter/node_modules/webpack/node_modules/tapable/lib/Hook.js:18:14)
    at Cache.storeBuildDependencies (/Users/bartek/Sites/private/vue-starter/node_modules/webpack/lib/Cache.js:122:37)
    at /Users/bartek/Sites/private/vue-starter/node_modules/webpack/lib/Compilation.js:1683:22
    at Hook.eval [as callAsync] (eval at create (/Users/bartek/Sites/private/vue-starter/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:4:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/bartek/Sites/private/vue-starter/node_modules/webpack/node_modules/tapable/lib/Hook.js:18:14)
    at /Users/bartek/Sites/private/vue-starter/node_modules/webpack/lib/Compilation.js:1676:34
    at Hook.eval [as callAsync] (eval at create (/Users/bartek/Sites/private/vue-starter/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:4:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/bartek/Sites/private/vue-starter/node_modules/webpack/node_modules/tapable/lib/Hook.js:18:14)
    at /Users/bartek/Sites/private/vue-starter/node_modules/webpack/lib/Compilation.js:1665:35
    at Hook.eval [as callAsync] (eval at create (/Users/bartek/Sites/private/vue-starter/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:4:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/bartek/Sites/private/vue-starter/node_modules/webpack/node_modules/tapable/lib/Hook.js:18:14)
    at /Users/bartek/Sites/private/vue-starter/node_modules/webpack/lib/Compilation.js:1655:39
    at Hook.eval [as callAsync] (eval at create (/Users/bartek/Sites/private/vue-starter/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:4:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/bartek/Sites/private/vue-starter/node_modules/webpack/node_modules/tapable/lib/Hook.js:18:14)
    at cont (/Users/bartek/Sites/private/vue-starter/node_modules/webpack/lib/Compilation.js:1649:35)
    at /Users/bartek/Sites/private/vue-starter/node_modules/webpack/lib/Compilation.js:1704:8
    at /Users/bartek/Sites/private/vue-starter/node_modules/neo-async/async.js:2830:7
    at Object.each (/Users/bartek/Sites/private/vue-starter/node_modules/neo-async/async.js:2850:39)
    at Compilation.createChunkAssets (/Users/bartek/Sites/private/vue-starter/node_modules/webpack/lib/Compilation.js:2377:12)
    at /Users/bartek/Sites/private/vue-starter/node_modules/webpack/lib/Compilation.js:1700:12
    at Hook.eval [as callAsync] (eval at create (/Users/bartek/Sites/private/vue-starter/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:4:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/bartek/Sites/private/vue-starter/node_modules/webpack/node_modules/tapable/lib/Hook.js:18:14)
95% emitting(node:78415) [DEP_WEBPACK_MAIN_TEMPLATE_GET_PUBLIC_PATH] DeprecationWarning: MainTemplate.getPublicPath is depreacted (use Compilation.getAssetPath(compilation.outputOptions.publicPath, opt
ions) instead)
    at HtmlWebpackPlugin.htmlWebpackPluginAssets (/Users/bartek/Sites/private/vue-starter/node_modules/html-webpack-plugin/index.js:532:56)
    at /Users/bartek/Sites/private/vue-starter/node_modules/html-webpack-plugin/index.js:164:29
    at _next0 (eval at create (/Users/bartek/Sites/private/vue-starter/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:33:1)
    at eval (eval at create (/Users/bartek/Sites/private/vue-starter/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:53:1)
    at /Users/bartek/Sites/private/vue-starter/node_modules/copy-webpack-plugin/dist/index.js:91:9
Hash: dad4517c458e40de7e55
Version: webpack 5.0.0-beta.13
Time: 2821ms

Environment

Node.js v12.16.0
darwin 19.4.0
npm 6.13.4
webpack@5.0.0-beta.13
html-webpack-plugin@4.2.0
@jantimon
Copy link
Owner

jantimon commented Apr 28, 2020

Thanks for bringing this up 👍

Can we fix this if we want to support webpack 4 and webpack 5?

In other terms - is Compilation.getAssetPath supported for webpack 4?

@shengliangli
Copy link

same + 1

@artola
Copy link

artola commented Jun 1, 2020

Thanks for bringing this up 👍

Can we fix this if we want to support webpack 4 and webpack 5?

In other terms - is Compilation.getAssetPath supported for webpack 4?

@jantimon It is not available in v4 Compilation.js. Then we could use some construction as compilation.getAssetPath ? compilation.getAssetPath(...) : "same as before"

@jantimon
Copy link
Owner

fixed in the latest alpha of html-webpack-plugin 5.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants