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

fix(server-renderer): avoid using s regex flag #11048

Merged
merged 1 commit into from
Jun 4, 2024
Merged

Conversation

sxzz
Copy link
Member

@sxzz sxzz commented May 31, 2024

The s (dotAll) regexp flag is not supported in ES2015.

See also https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/dotAll

The code is converted by Babel

Copy link

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 91 kB 34.6 kB 31.2 kB
vue.global.prod.js 148 kB 53.8 kB 48.1 kB

Usages

Name Size Gzip Brotli
createApp 51 kB 19.9 kB 18.2 kB
createSSRApp 54.3 kB 21.3 kB 19.4 kB
defineCustomElement 53.2 kB 20.7 kB 18.9 kB
overall 64.7 kB 25 kB 22.6 kB

@sxzz sxzz requested a review from yyx990803 May 31, 2024 16:08
@yyx990803
Copy link
Member

This is server-side code so we are not limited to ES2015 but more like what is supported in latest Node LTS. dotAll seems to have been supported in Node since version 8 so I don't think this is necessary?

@sxzz
Copy link
Member Author

sxzz commented Jun 3, 2024

In TypeScript 5.5, an error will occur because the target in tsconfig.json is set to ES2016.

@sxzz
Copy link
Member Author

sxzz commented Jun 4, 2024

Without dotAll, the performance will be barely better

png

Additionally, our documentation also seems to lack the environmental requirements for the server-renderer.

@yyx990803 yyx990803 merged commit f94568b into main Jun 4, 2024
15 checks passed
@yyx990803 yyx990803 deleted the fix/regex-single branch June 4, 2024 12:12
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