postcss-hover-media-feature icon indicating copy to clipboard operation
postcss-hover-media-feature copied to clipboard

After updating tailwindcss to 3.3.1 this plugin caused an infinite build

Open remorses opened this issue 2 years ago • 4 comments

With latest [email protected] this package caused an infinite build time with 100% CPU usage

This may be a similar issue to #20

remorses avatar Apr 09 '23 10:04 remorses

The problem is in isAlreadyNested: https://github.com/saulhardman/postcss-hover-media-feature/blob/master/index.js#L43

Maybe a quick fix would be to limit how many times run the while loop and stop

remorses avatar Apr 09 '23 10:04 remorses

Hi @remorses, thanks for creating an issue 🙏 I'll take a look into the cause of the infinite loop – perhaps we need to use an alternative method for checking whether a rule is already nested within the media query. I'll update the issue when I know more and hopefully we can find a solution beyond restriction the number of loop cycles.

saulhardman avatar Apr 10 '23 18:04 saulhardman

@remorses would you be able to provide an example project that exhibits this issue?

saulhardman avatar Apr 10 '23 18:04 saulhardman

Thank you for the quick reply 🙏

Here is a reproduction: https://stackblitz.com/edit/node-jzchab?file=package.json

After you run npm run repro postcss will run forever

remorses avatar Apr 11 '23 09:04 remorses