question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support Webpack 5

See original GitHub issue

This plugin doesn’t work with Webpack 5. Here’s a minimal example of how it fails:

[user@academic:~/favicons-webpack-plugin-webpack-5-example]% cat webpack.config.js 
const HtmlPlugin = require('html-webpack-plugin');
const FaviconsPlugin = require('favicons-webpack-plugin');

module.exports = {
	plugins: [
		new HtmlPlugin(),
		new FaviconsPlugin(),
	],
};
[user@academic:~/favicons-webpack-plugin-webpack-5-example]% cat package.json 
{
  "name": "favicons-webpack-plugin-webpack-5-example",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "favicons-webpack-plugin": "^4.2.0",
    "html-webpack-plugin": "^4.3.0",
    "webpack": "^5.0.0-beta.28",
    "webpack-cli": "^3.3.12"
  }
}
[user@academic:~/favicons-webpack-plugin-webpack-5-example]% npx webpack                   
(node:372532) [DEP_WEBPACK_MAIN_TEMPLATE_GET_ASSET_PATH] DeprecationWarning: MainTemplate.getAssetPath is deprecated (use Compilation.getAssetPath instead)
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:372532) [DEP_WEBPACK_TEMPLATE_PATH_PLUGIN_REPLACE_PATH_VARIABLES_HASH] DeprecationWarning: [hash] is now [fullhash] (also consider using [chunkhash] or [contenthash], see documentation for details)
(node:372532) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'assets' of undefined
    at /home/user/favicons-webpack-plugin-webpack-5-example/node_modules/favicons-webpack-plugin/src/compiler.js:69:47
    at /home/user/favicons-webpack-plugin-webpack-5-example/node_modules/webpack/lib/Compiler.js:486:11
    at /home/user/favicons-webpack-plugin-webpack-5-example/node_modules/webpack/lib/Compiler.js:981:17
    at eval (eval at create (/home/user/favicons-webpack-plugin-webpack-5-example/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:13:1)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:372532) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:372532) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[user@academic:~/favicons-webpack-plugin-webpack-5-example]% node --no-deprecation node_modules/.bin/webpack
(node:373112) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'assets' of undefined
    at /home/user/favicons-webpack-plugin-webpack-5-example/node_modules/favicons-webpack-plugin/src/compiler.js:69:47
    at /home/user/favicons-webpack-plugin-webpack-5-example/node_modules/webpack/lib/Compiler.js:486:11
    at /home/user/favicons-webpack-plugin-webpack-5-example/node_modules/webpack/lib/Compiler.js:981:17
    at eval (eval at create (/home/user/favicons-webpack-plugin-webpack-5-example/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:13:1)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:373112) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
[user@academic:~/favicons-webpack-plugin-webpack-5-example]% 

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:18
  • Comments:45 (20 by maintainers)

github_iconTop GitHub Comments

17reactions
smorimotocommented, Oct 10, 2020

5 has already been released and it seems to make a lot of sense to complete this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

To v5 from v4 - webpack
This guide aims to help you migrating to webpack 5 when using webpack directly. If you are using a higher level tool to...
Read more >
support webpack@5 · Issue #327 - GitHub
Issue description ... Technical info Webpack Bundle Analyzer version: latest Webpack version: next (5) Node.js version: 10.13.0 npm/yarn version: npm 6.13.4 ...
Read more >
Webpack 5 Adoption - Next.js
Next.js has adopted webpack 5 as the default for compilation. We've spent a lot of effort into ensuring the transition from webpack 4...
Read more >
Upgrading Webpack 4 → 5 | Square Corner Blog
We used mocha-webpack to build and run our mocha tests. We realized mocha-webpack didn't support Webpack 5 and is no longer maintained. There ......
Read more >
Webpack 5 Migration - Nx
Webpack 5 comes with Nx 13, and your apps should work as long as you use compatible webpack plugins (or don't have customized...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found