rrweb
rrweb copied to clipboard
fix(postcss-hover-classes): avoid large regex overflow by filtering selectors
Problem
When using the old postcss-hover-classes plugin, large stylesheets with many :hover selectors caused the following error:
Regular expression too large
This is reported in #1675.
Solution
This PR rewrites the plugin logic with the following improvements:
- Filters out only
:hoverselectors before applying replacements - Uses a
WeakSetto ensure we only process each rule once - Avoids unnecessary string operations and large regex inputs
This not only solves the regex overflow issue but also improves memory efficiency and overall performance when processing large stylesheets.
Related Issue
Closes #1675