Skip to content

Commit 149ae91

Browse files
mandariniclaude
andcommitted
fix(misc): consolidate magic comments for rolldown
Rolldown's printer only preserves block comments containing @__PURE__, @__NO_SIDE_EFFECTS__, or @vite-ignore. Standalone webpackIgnore / turbopackIgnore blocks were stripped from dist/index.mjs, leaving the surviving @vite-ignore alone and breaking Next.js Edge / Turbopack builds. Merging all three directives into a single @vite-ignore-bearing comment lets rolldown keep the entire block; webpack and turbopack both scan for their keyword anywhere in adjacent comments. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent ebfbb42 commit 149ae91

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

packages/shared/tracing/src/extract.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,16 @@ function loadOtel(): Promise<any | null> {
2323
// error with `Module not found: Can't resolve '@opentelemetry/api'`
2424
// when the peer dep is absent. The variable specifier (OTEL_PKG)
2525
// also helps for bundlers that don't honor the comments.
26+
//
27+
// All three directives live in one block because rolldown's printer
28+
// only preserves block comments containing `@__PURE__`,
29+
// `@__NO_SIDE_EFFECTS__`, or `@vite-ignore`; standalone
30+
// `/* webpackIgnore */` / `/* turbopackIgnore */` blocks get stripped
31+
// from dist/index.mjs. Webpack and Turbopack both scan for their
32+
// keyword anywhere in adjacent comments, so a shared block is honored.
2633
otelModulePromise = (
2734
import(
28-
/* webpackIgnore: true */ /* @vite-ignore */ /* turbopackIgnore: true */ OTEL_PKG
35+
/* @vite-ignore webpackIgnore: true turbopackIgnore: true */ OTEL_PKG
2936
) as Promise<any>
3037
).catch(() => null)
3138
}

0 commit comments

Comments
 (0)