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

fix: add missing peer dependency `html-webpack-plugin` #91

Closed merceyz closed 2 years ago

merceyz commented 2 years ago

What's the problem this PR addresses?

critters-webpack-plugin tries to require html-webpack-plugin (https://github.com/GoogleChromeLabs/critters/blob/5e32531caf7540842ff9af99e9449975bf0ad399/packages/critters-webpack-plugin/src/index.js#L71-L75) but doesn't declare it as a dependency which means under strict dependency environments or if hoisting isn't in its favour it wont get access to it. https://yarnpkg.com/advanced/rulebook/#packages-should-only-ever-require-what-they-formally-list-in-their-dependencies

Ref https://github.com/preactjs/preact-cli/pull/1608#issuecomment-988417698 (cc @rschristian)

How did you fix it?

Based on how critters-webpack-plugin is trying to use html-webpack-plugin I added it as an optional peer dependency.