chore: Address issues with /*#__PURE__*/ annotations placed inside parens cause Rolldown/Vite 8#517
Merged
Conversation
nev21
commented
Jun 1, 2026
Contributor
- address issues with /#PURE/ annotations placed inside parens cause Rolldown/Vite 8 [INVALID_ANNOTATION] warnings and disable tree-shaking
- add a generated-artifact validation script at bundle-pure-annotations-check.js to scan packaged JavaScript under bundle and dist outputs
- fail when PURE annotations have whitespace after opening parenthesis, and report file plus line for quick diagnosis
- add progress logging to show discovered files and each file being processed
- run the new validation as part of size-check in package.json
- widen the PURE annotation normalization spacing matcher in rollup.config.js to tolerate larger whitespace ranges before rewriting to canonical form
There was a problem hiding this comment.
Pull request overview
Addresses Rolldown/Vite 8 [INVALID_ANNOTATION] warnings caused by /*#__PURE__*/ annotations emitted with whitespace between the opening paren and the comment, which disables tree-shaking. Adds a rollup plugin to normalize emitted annotations and a post-build validation script.
Changes:
- Add
fixPureAnnotationsrollup plugin (usingmagic-string) that rewrites spaced PURE annotations to the canonical(/*#__PURE__*/form across all rollup configs. - Add
lib/test/bundle-pure-annotations-check.jsto scanlib/bundleandlib/dist.jsoutputs for invalid annotations and fail the build with file:line diagnostics. - Wire the new check into the
size-checknpm script.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| package.json | Chains the new annotation check after bundle-size-check in the size-check script. |
| lib/test/bundle-pure-annotations-check.js | New script recursively scanning generated JS for invalid PURE annotations and reporting failures. |
| lib/rollup.config.js | Adds MagicString import, defines fixPureAnnotations() plugin, and appends it to factory/main/polyfill rollup configs. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #517 +/- ##
=======================================
Coverage 97.57% 97.57%
=======================================
Files 28 28
Lines 1484 1484
Branches 350 350
=======================================
Hits 1448 1448
Misses 36 36 🚀 New features to boost your workflow:
|
f8a3cc4 to
5b4a2e4
Compare
…rens cause Rolldown/Vite 8 - address issues with /*#__PURE__*/ annotations placed inside parens cause Rolldown/Vite 8 [INVALID_ANNOTATION] warnings and disable tree-shaking - add a generated-artifact validation script at bundle-pure-annotations-check.js to scan packaged JavaScript under bundle and dist outputs - fail when PURE annotations have whitespace after opening parenthesis, and report file plus line for quick diagnosis - add progress logging to show discovered files and each file being processed - run the new validation as part of size-check in package.json - widen the PURE annotation normalization spacing matcher in rollup.config.js to tolerate larger whitespace ranges before rewriting to canonical form
nevware21-bot
approved these changes
Jun 1, 2026
nevware21-bot
left a comment
Contributor
There was a problem hiding this comment.
Approved by nevware21-bot
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.