Rollup tries to interpret references to `@__PURE__` annotations in Zod's comments
Author: audibleptrCreated Sep 21, 2026Updated Sep 25, 2026
Hello, using either Zod 4.6.5 or 4.5.4, the following warnings appear during vite build that did not appear when building with Zod 4.3.5:
[info] vite v5.4.3 building for production...
[info] transforming...
node_modules/zod/v4/core/util.js (400:0): A comment
"// Wrapped in a `@__PURE__` IIFE: esbuild never tree-shakes a top-level initializer that contains a member access on `Number`, so the bare object literal survived into every bundle."
in "node_modules/zod/v4/core/util.js" contains an annotation that Rollup cannot interpret due to the position of the comment. The comment will be removed to avoid issues.
node_modules/zod/v4/core/regexes.js (74:0): A comment
"/** Anchors a pattern source. The interpolation lives here rather than at the call site because
* esbuild will not drop a `@__PURE__` call whose own argument interpolates a variable, but it
* will drop `anchor(dateSource)`. Keeping it inline pinned `date` into every bundle. */"
in "node_modules/zod/v4/core/regexes.js" contains an annotation that Rollup cannot interpret due to the position of the comment. The comment will be removed to avoid issues.
[info] ✓ 3679 modules transformed.Rollup is trying to interpret references to bundler annotations in these comments as actual annotations, correctly failing to do so as they are not, but still emitting warnings.
Would it be possible to avoid including these annotations in comments or otherwise address it in Zod? Or should this be addressed or configured to be ignored on the bundler side?
Source: colinhacks/zod