frandiox / vite-ssr

Use Vite for server side rendering in Node
MIT License
829 stars 92 forks source link

[Safari + Dev Environment] SyntaxError due to Invalid Regular Expression because of negative lookbehind(?<!) regex #118

Closed salqueng closed 2 years ago

salqueng commented 3 years ago

image

After upgrading vite-ssr to 0.14.x, dev environment on safari cannot start the application and raises "SyntaxError due to Invalid Regular Expression"

I found that vite-ssr after 0.14.x uses negative lookbehind regexes for escape quotes. https://github.com/frandiox/vite-ssr/commit/a11c71fd62818054d838ff50377b6ed33e5946c4#diff-c0c7e7c3cf0479dd9b445973222df8e9107e0d3659215f379406b21288097031

However, those regexps break dev environment on Safari, because Safari does not support lookbehind regexes. https://caniuse.com/js-regexp-lookbehind

salqueng commented 3 years ago

I'll post a PR to fix it

frandiox commented 3 years ago

@salqueng Thanks! Safari is the new IE 😅