feat(esbuild): add DI worker bundling support#7440
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Overall package sizeSelf size: 4.57 MB Dependency sizes| name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 2.0.6 | 81.92 kB | 813.08 kB | | dc-polyfill | 0.1.10 | 26.73 kB | 26.73 kB |🤖 This report was automatically generated by heaviest-objects-in-the-universe |
This comment has been minimized.
This comment has been minimized.
fee4057 to
b2bb277
Compare
194df87 to
86646ea
Compare
b2bb277 to
cf33a26
Compare
86646ea to
7d2637c
Compare
BenchmarksBenchmark execution time: 2026-02-05 10:31:42 Comparing candidate commit f999386 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 231 metrics, 29 unstable metrics. |
e20aace to
e03094e
Compare
7d2637c to
6c3e7ad
Compare
e03094e to
8467905
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7440 +/- ##
=======================================
Coverage 80.41% 80.41%
=======================================
Files 732 732
Lines 31051 31051
=======================================
Hits 24971 24971
Misses 6080 6080
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Add support for bundling the Live Debugging (LD) / Dynamic Instrumentation (DI) worker when building applications with esbuild. This enables LD/DI features to work in bundled applications. The plugin now: - Emits a separate worker bundle (dd-trace-debugger-worker.cjs) alongside the main application bundle - Patches the debugger module to reference the emitted worker - Patches the worker's dd-trace lookup to use global._ddtrace for bundler compatibility
8467905 to
f999386
Compare
There was a problem hiding this comment.
Pull request overview
This PR adds support for bundling the Live Debugging (LD) / Dynamic Instrumentation (DI) worker when building applications with esbuild. This enables LD/DI features to function correctly in bundled applications where the worker thread would otherwise fail to find the worker file on disk.
Changes:
- Emits a separate worker bundle (
dd-trace-debugger-worker.cjs) alongside the main application bundle - Patches the debugger module to reference the emitted worker bundle instead of the original source location
- Patches the worker's trace/span lookup to use
global._ddtracefor bundler compatibility
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/datadog-esbuild/index.js | Adds core implementation: debugger index transformation, worker bundle building logic, and helper functions for output directory resolution |
| integration-tests/esbuild/index.spec.js | Adds cleanup for the new worker bundle file in existing tests |
| integration-tests/esbuild/build-and-test-debugger-worker.js | New comprehensive test file that verifies worker bundle emission, content validation, and runtime behavior with DI enabled |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

What does this PR do?
Add support for bundling the Live Debugging (LD) / Dynamic Instrumentation (DI) worker when building applications with esbuild. This enables LD/DI features to work in bundled applications.
The plugin now:
dd-trace-debugger-worker.cjs) alongside the main application bundleglobal._ddtracefor bundler compatibilityMotivation
Without this, LD/DI would not work in a bundled application, as the worker thread would emit an
errorevent when started, saying it couldn't find the worker file on disk.