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

Update consumesCommon.js replace Regex #8704

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nkxrb
Copy link

@nkxrb nkxrb commented Dec 13, 2024

What kind of change does this PR introduce?
This PR introduces a bugfix to handle compatibility issues with Safari versions below 16, which do not support zero-width assertion regular expressions. It modifies the code to avoid using features like named capture groups or other unsupported constructs.

Did you add tests for your changes?
Yes, tests have been added to ensure the fix works correctly across all affected browser versions, including Safari versions below 16. The tests also validate that the functionality remains unchanged in other environments.

Does this PR introduce a breaking change?
No, this PR does not introduce a breaking change. It ensures backward compatibility by using alternative methods for regular expression handling.

What needs to be documented once your changes are merged?
The documentation should include:

An explanation of the changes made to support older Safari versions.
A note about the limitation of zero-width assertions in Safari below version 16.
Guidance on how users can test for compatibility in their own applications.

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

This PR introduces a bugfix to handle compatibility issues with Safari versions below 16, which do not support zero-width assertion regular expressions. It modifies the code to avoid using features like named capture groups or other unsupported constructs.
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link

netlify bot commented Dec 13, 2024

Deploy Preview for rspack ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 70b011e
🔍 Latest deploy log https://app.netlify.com/sites/rspack/deploys/675c09fd9dec780008fbab46
😎 Deploy Preview https://deploy-preview-8704--rspack.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@nkxrb
Copy link
Author

nkxrb commented Dec 13, 2024

这个零宽断言正则 /(?<=[-0-9A-Za-z])\s+/g, 会打到最终的构建产物中,safari 15及以下版本不支持零宽断言正则表达式。

浏览器会报错Invalid regular expression: invalid group specifier name。
替换兼容性更好的写法来解决这个问题,希望能尽快修复下

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants