Commit 2b5ae26
fix: externalize
When `instrumentation.server.js` and application code both import
`@opentelemetry/api`, the bundler may colocate it into a shared chunk
that also contains application modules. The compiled instrumentation
entry then imports that chunk — evaluating application modules before
`Server.init()` has called `set_env()`.
Externalizing `@opentelemetry/api` ensures:
- No shared chunks between instrumentation and app code (via this dep)
- A single module instance so OTEL hooks registered in instrumentation
are visible to the SvelteKit runtime's tracer
Added to `ssr.external` in the kit Vite plugin and to adapter-node's
external list (since `@opentelemetry/api` is an optional peer dep, not
in `pkg.dependencies`, and wouldn't be matched by the existing regex).
Closes #16288@opentelemetry/api to prevent chunk colocation1 parent 96898e9 commit 2b5ae26
3 files changed
Lines changed: 24 additions & 2 deletions
File tree
- .changeset
- packages
- adapter-node
- kit/src/exports/vite
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
81 | 86 | | |
82 | 87 | | |
83 | 88 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
494 | 494 | | |
495 | 495 | | |
496 | 496 | | |
497 | | - | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
498 | 509 | | |
499 | 510 | | |
500 | 511 | | |
| |||
0 commit comments