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

[email protected] crashes in Hermes (React Native) environment #2843

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

[email protected] crashes in Hermes (React Native) environment #2843

birdofpreyru opened this issue Jun 11, 2023 · 7 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
@unitythemaker
Copy link

facebook/hermes#1027 seems to be closed. Anyone found a solution? I am still getting the error.

@UziTech
Copy link
Member

UziTech commented Nov 11, 2024

You should open another issue on that repo if you are still getting an error. It looks like it should have been fixed in facebook/hermes#1295. Make sure you are using an updated version of hermes

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

4 participants