GoogleChromeLabs / critters

🦔 A Webpack plugin to inline your critical CSS and lazy-load the rest.
https://npm.im/critters-webpack-plugin
Apache License 2.0
3.42k stars 108 forks source link

critters webpack plugin can't be uses with html-webpack-plugin v5 #170

Open RodrigoTomeES opened 1 month ago

RodrigoTomeES commented 1 month ago

If you have html-webpack-plugin v5 like in a AEM project npm throws an error because critters expect html-webpack-plugin v4 as an optional peer dependency.

npm i -D critters-webpack-plugin

npm warn ERESOLVE overriding peer dependency
npm warn While resolving: acorn-import-assertions@1.8.0
npm warn Found: acorn@6.4.2
npm warn node_modules/acorn
npm warn   peer acorn@"^6.0.0 || ^7.0.0 || ^8.0.0" from acorn-jsx@5.3.2
npm warn   node_modules/acorn-jsx
npm warn     acorn-jsx@"^5.3.2" from espree@9.4.0
npm warn     node_modules/espree
npm warn   1 more (the root project)
npm warn
npm warn Could not resolve dependency:
npm warn peer acorn@"^8" from acorn-import-assertions@1.8.0
npm warn node_modules/acorn-import-assertions
npm warn   acorn-import-assertions@"^1.7.6" from webpack@5.76.0
npm warn   node_modules/webpack
npm warn
npm warn Conflicting peer dependency: acorn@8.12.1
npm warn node_modules/acorn
npm warn   peer acorn@"^8" from acorn-import-assertions@1.8.0
npm warn   node_modules/acorn-import-assertions
npm warn     acorn-import-assertions@"^1.7.6" from webpack@5.76.0
npm warn     node_modules/webpack
npm error code ERESOLVE
npm error ERESOLVE could not resolve
npm error
npm error While resolving: critters-webpack-plugin@3.0.2
npm error Found: html-webpack-plugin@5.5.0
npm error node_modules/html-webpack-plugin
npm error   dev html-webpack-plugin@"^5.5.0" from the root project
npm error
npm error Could not resolve dependency:
npm error peerOptional html-webpack-plugin@"^4.5.2" from critters-webpack-plugin@3.0.2
npm error node_modules/critters-webpack-plugin
npm error   dev critters-webpack-plugin@"*" from the root project
npm error
npm error Conflicting peer dependency: html-webpack-plugin@4.5.2
npm error node_modules/html-webpack-plugin
npm error   peerOptional html-webpack-plugin@"^4.5.2" from critters-webpack-plugin@3.0.2
npm error   node_modules/critters-webpack-plugin
npm error     dev critters-webpack-plugin@"*" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.