Repository navigation
Closed
Description
Description
When building a project using Vite 8 (which now uses Rolldown as its bundler), the build output is spammed with INVALID_ANNOTATION warnings originating from @microsoft/applicationinsights-web and @microsoft/applicationinsights-core-js.
Rolldown is much stricter than Rollup/Webpack regarding the AST positioning of /#PURE/ comments. It flags pure annotations placed before string literals, null values, or inside grouping parentheses as invalid:
https://rolldown.rs/in-depth/dead-code-elimination#pure
Steps to Reproduce
-
Create a new Vite 8 project.
-
Install @microsoft/applicationinsights-web.
-
Import and initialize Application Insights.
-
Run npm run build.
Expected behavior
The project should build without pure annotation warnings.
Logs
[INVALID_ANNOTATION] A comment "/*#__PURE__*/" in "node_modules/@microsoft/applicationinsights-web/dist-es5/internal/trace/spanUtils.js" contains an annotation that Rolldown cannot interpret due to the position of the comment.
╭─[ node_modules/@microsoft/applicationinsights-web/dist-es5/internal/trace/spanUtils.js:33:18 ]
33 │ var HTTP_DOT = ( /*#__PURE__*/"http.");
│ ──────┬──────
│ ╰──────── comment ignored due to position
[INVALID_ANNOTATION] A comment "/* #__PURE__*/" in "node_modules/@microsoft/applicationinsights-web/dist-es5/internal/trace/spanUtils.js" contains an annotation that Rolldown cannot interpret due to the position of the comment.
╭─[ node_modules/@microsoft/applicationinsights-web/dist-es5/internal/trace/spanUtils.js:34:45 ]
34 │ var _MS_PROCESSED_BY_METRICS_EXTRACTORS = ( /* #__PURE__*/"_MS.ProcessedByMetricExtractors");
│ ───────┬──────
│ ╰──────── comment ignored due to position
[INVALID_ANNOTATION] A comment "/* #__PURE__*/" in "node_modules/@microsoft/applicationinsights-core-js/dist-es5/ext/extUtils.js" contains an annotation that Rolldown cannot interpret due to the position of the comment.
╭─[ node_modules/@microsoft/applicationinsights-core-js/dist-es5/ext/extUtils.js:54:29 ]
54 │ var uInt8ArraySupported = ( /* #__PURE__*/null);
│ ───────┬──────
│ ╰──────── comment ignored due to position
Reacted by Hrithik Agarwal, Hrithik Agarwal, Miro Rauhala, Andreas Bjerga, throwaway34059, Andrei Danciu and Benjamin
Metadata
Metadata
Assignees
Labels
No labels
Activity
PetterRuud commentedon May 22, 2026
Quick "fix" for now
In vite.config
under resolve
vite 7
under build.rollupOptions.output
vite 8
hrithik-infinite commentedon May 25, 2026
The root cause for one of the three reported files is now fixed upstream: the
@nevware21/ts-utilsannotations (ts-utils.js) were corrected in nevware21/ts-utils#569 (merged, tracking issue #568).However, the warnings in this issue's logs originate from App Insights' own shipped ES5 bundles, not from ts-utils:
@microsoft/applicationinsights-web/dist-es5/internal/trace/spanUtils.js:33,34@microsoft/applicationinsights-core-js/dist-es5/ext/extUtils.js:54These have the same misplaced
/*#__PURE__*/pattern (inside grouping parens, before string/nullliterals) that Rolldown rejects. They won't be resolved by the ts-utils fix alone. Two things are needed here:/*#__PURE__*/placement inapplicationinsights-web/applicationinsights-core-jssource so it survives the ES5 build, and@nevware21/ts-utilscontaining HandledAt is not tracked in Exception #569.Reproduced on
applicationinsights-web@3.4.1/applicationinsights-core-js@3.4.1with Vite 8 (vite@8.0.14, Rolldown).I'm happy to raise a PR for the
applicationinsights-web/applicationinsights-core-jssource fix — let me know if that'd be welcome.danciudev commentedon Jun 14, 2026
Any updates on this?
fix(#2736): canonicalize PURE annotations in dist-es5 (module) output (…