highlight.js
highlight.js copied to clipboard
Invalid RegExp when using `highlightAll()`
Describe the issue/behavior that seems buggy
Hi, it seems when using highlightAll() the following error throws out
Invalid regular expression: /(?!-)([!#\$%&*+.\\/<=>?@\\\\^~-]|(?!([(),;\\[\\]\`|{}]|[_:"']))(\\p{S}|\\p{P}))--+|--+(?!-)([!#\$%&*+.\\/<=>?@\\\\^~-]|(?!([(),;\\[\\]\`|{}]|[_:"']))(\\p{S}|\\p{P}))/mu: Invalid escape
Sample Code or Instructions to Reproduce
Expected behavior
No regexp errors
Additional context
Im using NextJS 14.1.0 This error only happens in production build
Does your regex engine support \p. That is a requirement.
Is this reproducible in the latest version of desktop Chrome?
Closing along with #4013. (lack of response). Current best guess is a broken build system corrupting the JS code.
Hi, sorry i didnt notice your replies, will check and get back
this was fixed by adding highlight.js to transpilePackages in next config
https://nextjs.org/docs/app/api-reference/next-config-js/transpilePackages
That's a nice little trick until it better supports these regex constructs.