-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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: use string manipulation instead of regex to inject esbuild helpers #14094
Conversation
Run & review this pull request in StackBlitz Codeflow. |
@patak-dev @sapphi-red @bluwy would you please review this? We're currently blocked on webpack-to-vite switch due to umd build hanging caused by regex. Let me know if I got anything wrong and I'll fix. Thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense to me and looks more performant too. Thanks for the PR!
Will wait for another eye on this before merging.
evanw/esbuild#3322 has been fixed. |
Description
Fix #14065 lib mode hanging for umd build, by using string manipulation instead of regex
Additional context
The original fix #7948 used regex for string replacement to avoid global esbuild helpers.
It has since caused multiple performance issues #8738 #8099 #10900 #14065, and received numerous attempts #8110 #8741 #10905 at fixing it, but there're still unhandled cases:
I think this shows that regex isn't the right solution in this scenario. It's easier to manipulate the string directly, at the cost of a few extra lines.
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).