Clean output without deprecation warning
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
```
Node.js v12.16.0
darwin 19.4.0
npm 6.13.4
[email protected]
[email protected]
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?
same + 1
Thanks for bringing this up 👍
Can we fix this if we want to support
webpack 4andwebpack 5?In other terms - is
Compilation.getAssetPathsupported forwebpack 4?
@jantimon It is not available in v4 Compilation.js. Then we could use some construction as compilation.getAssetPath ? compilation.getAssetPath(...) : "same as before"
fixed in the latest alpha of html-webpack-plugin 5.x
Most helpful comment
fixed in the latest alpha of html-webpack-plugin 5.x