Tom-Bonnike/netlify-plugin-inline-critical-css

Failing on page with large json schema

dominic-blain opened this issue · 3 comments

This is probably an issue with Critical or another underlying package but I have encountered this issue where there is a regex that is created with the whole content of the script tag for our schema.org schema (<script data-n-head="ssr" type="application/ld+json">).

Logs from the Netlify build script:

Invalid regular expression: /([^\S\r\n]*){"@context":"https://schema.org",
[...] 
: Regular expression too large

This is only happening when trying to upgrade from 1.2.0 to 2.0.0
Maybe you have an idea of the source of the issue?

Thanks

Do you have a bigger stacktrace in the logs by any chance?

The issue is most likely not with the plugin itself, you could try to reproduce by running critical directly on the HTML file containing this script tag. If it also errors out, we should move this issue to the critical repo, the folks there will know better!

This is only happening when trying to upgrade from 1.2.0 to 2.0.0

Must have been introduced in one of these 😅
addyosmani/critical@v2.0.6...v4.0.1

Feel free to re-open if it actually belongs here ☝️

Hey @Tom-Bonnike kinda forgot about this, thanks for your response earlier. I didn't reproduce with critical but we actually did not need the plugin so I didn't put more time into this. We can keep this closed for sure! Cheers