Repository navigation
fix(cloudflare): Skip comments when locating the default keyword in the Vite transform - #25741
Open
sentry-junior[bot] wants to merge 2 commits into
Open
sentry-junior[bot] wants to merge 2 commits into
sentry-junior[bot] wants to merge 2 commits into
Conversation
… the Vite transform A comment between `export default` and the expression that contained the word `default` moved the overwrite past the keyword and produced invalid syntax. Co-Authored-By: Isaac Schlueter <[email protected]>
isaacs
marked this pull request as ready for review
October 25, 2026 23:00
isaacs
requested review from
andreiborza and
isaacs
and removed request for
a team
October 25, 2026 23:00
Contributor
size-limit report 📦Compared: eb8dd05 (PR test merge using develop at a734d03) Against: a734d03 (develop) · base run #63553 ✅ Baseline matches: this diff contains only this PR's changes.
|
…g regex CodeQL flagged the comment-skipping regex as prone to exponential backtracking. A linear scan over whitespace and comments finds the same offset.
Contributor
Optional E2E testsAll optional checks were successful. 32 successful. See the run. Successful checks
|
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The transform found the end of the
export defaultkeywords withlastIndexOf('default')on the text before the expression. A comment in that span that contains the worddefault, such asexport default /* default handler */ { ... }, moved the overwrite past the keyword and produced invalid syntax, so the Worker failed to start.The keyword is now found by matching
export, then any whitespace or comments, thendefault, starting at the statement. Acorn only gives anExportDefaultDeclarationwhen that sequence is there, so the match always succeeds.Cursor Bugbot found this on the v10 backport in #25732, which already has the same fix.
via Isaac Schlueter.
--
View Junior Session [Sentry]