💥 use ESM dynamic imports for CDN async chunks#4217
Merged
BenoitZugmeyer merged 3 commits intov7from Feb 20, 2026
Merged
Conversation
|
✅ Tests 🎉 All green!❄️ No new flaky tests detected 🎯 Code Coverage (details) 🔗 Commit SHA: 26f952a | Docs | Datadog PR Page | Was this helpful? Give us feedback! |
Bundles Sizes Evolution
🚀 CPU Performance
🧠 Memory Performance
|
4e17b56 to
26f952a
Compare
Member
Author
|
/to-staging |
|
View all feedbacks in Devflow UI.
Commit 26f952a1f2 will soon be integrated into staging-08.
Commit 26f952a1f2 has been merged into staging-08 in merge commit 4e179f9a3b. Check out the triggered DDCI request. If you need to revert this integration, you can use the following command: |
gh-worker-dd-mergequeue-cf854d Bot
added a commit
that referenced
this pull request
Feb 20, 2026
Integrated commit sha: 26f952a Co-authored-by: BenoitZugmeyer <benoit.zugmeyer@datadoghq.com>
thomas-lebeau
approved these changes
Feb 20, 2026
mormubis
approved these changes
Feb 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
CDN async chunks (recorder, profiler) were previously loaded via JSONP (script tag injection). Switching to native ESM dynamic imports aligns chunk loading with modern browser capabilities and removes the need for a global chunk registry.
ESM dynamic imports require the main script tag to have a
crossoriginattribute, and the developer extension's inline script injection needed to be updated to rewrite relative chunk import paths to absolute URLs.Changes
webpack.base.ts: setchunkFormat: 'module'andchunkLoading: 'import'to emit async chunks as ES modules loaded viaimport(). The main entry bundle format is unchanged.<script>tags andcreateElement('script')calls loading the SDK bundle now include acrossoriginattribute (test apps, E2E framework, performance tests, sandbox).developer-extension: the dev bundle injection rewrites relativeimport('./...')paths to absolute URLs, since the script is injected inline rather than loaded via<script src\>.Test instructions
Build the SDK (
yarn build) and verify the generated files inbundle/chunks/are valid ES modules.Checklist