Skip to content

fix: clear Vite 8 / Rolldown INVALID_ANNOTATION pure-comment warnings#2739

Open
hrithik-infinite wants to merge 2 commits into
microsoft:mainfrom
hrithik-infinite:fix/2736-pure-annotations
Open

fix: clear Vite 8 / Rolldown INVALID_ANNOTATION pure-comment warnings#2739
hrithik-infinite wants to merge 2 commits into
microsoft:mainfrom
hrithik-infinite:fix/2736-pure-annotations

Conversation

@hrithik-infinite

Copy link
Copy Markdown

What

Fixes #2736 - Vite 8 / Rolldown prints INVALID_ANNOTATION warnings when it
bundles Application Insights, because a few /*#__PURE__*/ comments are in
spots Rolldown won't accept.

Two causes, both handled:

  1. Our own bundles had pure-comments on string/null values (not function
    calls), where they do nothing. Removed those.
  2. ts-utils < 0.15.0 had the same issue in its bundles, fixed upstream in
    Fix #__PURE__ annotations being ignored by Rolldown/Vite 8 (#568) nevware21/ts-utils#569. Bumped the dependency to >= 0.15.0.

How I checked

Built a small Vite 8 app against this: 3 warnings before, 0 after. All
core-js (873) and web (751) unit tests pass, and the minified bundle is
identical after removing the comments - no tree-shaking lost.

Note

The pure-comments on real function calls are left alone - their parentheses
keep tree-shaking working on older Rollup/Webpack/Terser (background in
nevware21/ts-utils#568). Size budgets were nudged up to fit ts-utils 0.15.0.

These pure-comments were on plain strings and a null value, not function
calls, so they never actually did anything. Rolldown (Vite 8) is stricter
and flags them as INVALID_ANNOTATION. Removing them (and the leftover
parens) clears the warnings without changing the output - the minified
bundle is byte-for-byte identical.

Touches HTTP_DOT and _MS_PROCESSED_BY_METRICS_EXTRACTORS in spanUtils.ts
and uInt8ArraySupported in extUtils.ts. Part of microsoft#2736.
ts-utils 0.15.0 fixes the same kind of pure-comment problem in its own
bundles (nevware21/ts-utils#569) - the other half of microsoft#2736. Raised the
floor everywhere and refreshed the shrinkwrap.

0.15.0 is slightly bigger, so the size checks just tip over. Nudged the
budgets to match what's actually there:
- core-js: raw 132->133, deflate 53->54 KB
- web:     raw 174->175, deflate 70->71 KB
Copilot AI review requested due to automatic review settings June 10, 2026 03:43
@hrithik-infinite hrithik-infinite requested a review from a team as a code owner June 10, 2026 03:43
@hrithik-infinite

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates project dependencies and related bundle-size guards to align with a newer @nevware21/ts-utils baseline.

Changes:

  • Bump @nevware21/ts-utils minimum version from 0.14.0 to 0.15.0 across packages/examples/tools.
  • Adjust bundle size threshold tests to match the new output sizes.
  • Remove redundant /*#__PURE__*/ annotations around literal initializers in a couple of TS sources.

Reviewed changes

Copilot reviewed 29 out of 30 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tools/shims/package.json Raise @nevware21/ts-utils minimum version.
tools/chrome-debug-extension/package.json Raise @nevware21/ts-utils minimum version.
shared/AppInsightsCore/src/ext/extUtils.ts Simplify literal initializer (remove redundant PURE wrapper).
shared/AppInsightsCore/package.json Raise @nevware21/ts-utils minimum version.
shared/AppInsightsCore/Tests/Unit/src/ai/AppInsightsCoreSize.Tests.ts Update size thresholds to reflect new bundle output.
shared/AppInsightsCommon/package.json Raise @nevware21/ts-utils minimum version.
shared/1ds-core-js/package.json Raise @nevware21/ts-utils minimum version.
extensions/applicationinsights-properties-js/package.json Raise @nevware21/ts-utils minimum version.
extensions/applicationinsights-perfmarkmeasure-js/package.json Raise @nevware21/ts-utils minimum version.
extensions/applicationinsights-osplugin-js/package.json Raise @nevware21/ts-utils minimum version.
extensions/applicationinsights-dependencies-js/package.json Raise @nevware21/ts-utils minimum version.
extensions/applicationinsights-debugplugin-js/package.json Raise @nevware21/ts-utils minimum version.
extensions/applicationinsights-clickanalytics-js/package.json Raise @nevware21/ts-utils minimum version.
extensions/applicationinsights-cfgsync-js/package.json Raise @nevware21/ts-utils minimum version.
extensions/applicationinsights-analytics-js/package.json Raise @nevware21/ts-utils minimum version.
examples/startSpan/package.json Raise @nevware21/ts-utils minimum version.
examples/shared-worker/package.json Raise @nevware21/ts-utils minimum version.
examples/dependency/package.json Raise @nevware21/ts-utils minimum version.
examples/cfgSync/package.json Raise @nevware21/ts-utils minimum version.
examples/AISKU/package.json Raise @nevware21/ts-utils minimum version.
common/Tests/Framework/package.json Raise @nevware21/ts-utils minimum version.
channels/tee-channel-js/package.json Raise @nevware21/ts-utils minimum version.
channels/offline-channel-js/package.json Raise @nevware21/ts-utils minimum version.
channels/applicationinsights-channel-js/package.json Raise @nevware21/ts-utils minimum version.
channels/1ds-post-js/package.json Raise @nevware21/ts-utils minimum version.
AISKULight/package.json Raise @nevware21/ts-utils minimum version.
AISKU/src/internal/trace/spanUtils.ts Simplify literal initializers (remove redundant PURE wrappers).
AISKU/package.json Raise @nevware21/ts-utils minimum version.
AISKU/Tests/Unit/src/AISKUSize.Tests.ts Update size thresholds to reflect new bundle output.
Files not reviewed (1)
  • common/config/rush/npm-shrinkwrap.json: Language not supported

"@microsoft/applicationinsights-shims": "3.0.1",
"@microsoft/dynamicproto-js": "^2.0.3",
"@nevware21/ts-utils": ">= 0.14.0 < 2.x",
"@nevware21/ts-utils": ">= 0.15.0 < 2.x",
Comment on lines +54 to +57
private readonly MAX_RAW_SIZE = 133;
private readonly MAX_BUNDLE_SIZE = 133;
private readonly MAX_RAW_DEFLATE_SIZE = 54;
private readonly MAX_BUNDLE_DEFLATE_SIZE = 54;
Comment on lines +57 to +60
private readonly MAX_RAW_SIZE = 175;
private readonly MAX_BUNDLE_SIZE = 175;
private readonly MAX_RAW_DEFLATE_SIZE = 71;
private readonly MAX_BUNDLE_DEFLATE_SIZE = 71;
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.

[Bug] Vite 8 / Rolldown build warnings: INVALID_ANNOTATION for misplaced /#PURE/ comments

2 participants