You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MajedMuhammad
changed the title
bug fix: regex 's' modifier removal for older browsers support
fix: regex 's' modifier removal for older browsers support
Jan 31, 2024
@patak-dev, sorry for mentioning you for a very minor bug.
However, you may want to accept this PR, it is nothing, but it just keeps support for legacy browsers.
No impact at all, it is equivalent.
The browsers supported by Vite should also support the s modifier, so I don't think we should avoid using this because of that.
But now that you brought this up, it doesn't look like we need to use the s modifier in the first place. The strings we're dealing with should always only be a single line. I think we can simply remove the s modifier as a perf improvement, and we can do the same for the others: https://github.com/search?q=repo%3Avitejs%2Fvite%20%2F%5B%3F%23%5D.*%24%2Fs&type=code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
p2-nice-to-haveNot breaking anything but nice to have (priority)
3 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Minor bug fix:
Fixes bug caused by this commit: 2687dbb
It is just a regex equivalent replacement:
.withsmodifier is 100% equal to[\s\S]withoutsmodifier.smodifier is causing older browsers to fail with a blank page with console error such as:SyntaxError: invalid regular expression flag sFuture Consideration
Please avoid accepting PRs that include commits including regex
smodifier/flag.What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123). X