Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Marked@5.1.0 crashes in Hermes (React Native) environment #2843

Closed
birdofpreyru opened this issue Jun 11, 2023 · 5 comments
Closed

Marked@5.1.0 crashes in Hermes (React Native) environment #2843

birdofpreyru opened this issue Jun 11, 2023 · 5 comments

Comments

@birdofpreyru
Copy link

birdofpreyru commented Jun 11, 2023

Marked version: 5.1.0

Describe the bug
When marked module is loaded, the following line gets called with regex equal ^((?![*_])[\s\p{P}$+<=>`|~]), which is deemed to be an invalid regular expression by Hermes engine (namely, it calls the error "Invalid escape", not giving more specific details), thus it throws on this line crashing the host app

return new RegExp(regex, opt);

It did not happen in the previous, v5.0.5 of marked.

To Reproduce
Steps to reproduce the behavior:

Expected behavior
A clear and concise description of what you expected to happen.

@UziTech
Copy link
Member

UziTech commented Jun 11, 2023

This sounds like a bug in Hermes. Unicode escapes have been in JavaScript since ES 2018.

@UziTech
Copy link
Member

UziTech commented Jun 11, 2023

One option is to use babel-plugin-transform-unicode-escapes and compile marked yourself to use older browser engines

@birdofpreyru
Copy link
Author

Thanks @UziTech , I double-checked it indeed fails on \p{P}, and reported the bug in Hermes repo (facebook/hermes#1027).

@djMax
Copy link

djMax commented May 8, 2024

How is this solved (real question, not snark)? I just tried a fresh project with latest and hermes still breaks on the regex.

@UziTech
Copy link
Member

UziTech commented May 8, 2024

This is an issue in Hermes not marked see facebook/hermes#1027

@UziTech UziTech closed this as not planned Won't fix, can't repro, duplicate, stale May 8, 2024
nominalrune added a commit to nominalrune/GrowiMobile that referenced this issue Aug 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants