perf(vite): add fast component annotation transform#22089
Conversation
| "data-sentry-source-file": "app.jsx" | ||
| }, void 0, false, { | ||
| fileName: _jsxFileName, | ||
| lineNumber: 4, |
There was a problem hiding this comment.
The updated line numbers are on purpose and actually "more correct" as they now point to the actual JSX component, not just the span around it.
There was a problem hiding this comment.
Noticed this as it was porting over!
| @@ -0,0 +1,314 @@ | |||
| import { transformAsync, traverse, types as t } from '@babel/core'; | |||
| import { parse } from '@babel/parser'; | |||
There was a problem hiding this comment.
Yes, this does use babel for testing as it is more convenient API-wise 😄
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e04ab6a. Configure here.
| }); | ||
|
|
||
| if (!isAstNode(ast)) { | ||
| return null; |
There was a problem hiding this comment.
Invalid AST skips Babel fallback
High Severity
When parseAstAsync resolves to a value that fails isAstNode, the Vite annotation hook returns null. Rollup treats null as a completed fast-path outcome and disables the Babel annotation fallback, so eligible .jsx/.tsx modules can ship without data-sentry-* attributes even though the slower transform would still apply them.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit e04ab6a. Configure here.
Lms24
left a comment
There was a problem hiding this comment.
Thanks for contributing @TheAlexLichter and for porting this over Tim!


Credit to @TheAlexLichter who opened this PR against the bundler plugins repo after we moved the functionality to this repo but before we managed to remove the orphaned package!