[SDC-32633] Document Web SDK UMD builds - #403
Conversation
| A classic `<script>` (unlike `<script type="module">`) does not support top-level `await`, so wrap the setup code in an async function as shown below. | ||
| ::: | ||
|
|
||
| ### Complete UMD Example |
There was a problem hiding this comment.
Can't we just keep the interesting part in this section? a complete example seems superfluous and gives a lot of space to UMD in this page.
There was a problem hiding this comment.
Done — dropped the full HTML page. The section now shows only the delta over the CDN example: the two <script> tags, the globals table, and a short snippet with the async wrapper. It went from ~113 lines to ~50.
- Replace the full HTML page with just the delta over the CDN example (script tags, globals, async wrapper), per review feedback that a complete example gives UMD too much space on this page. - Add a caution that UMD bundles can't be tree-shaken/optimized like the ESM build, so startup is slower, and that es-module-shims is the preferred fallback when import maps are the only blocker. UMD is a last resort. - Use DataCaptureContext.sharedInstance in the snippet. - Fix the CDN paths: the umd subpath resolves to build/js/umd/index.js, and only exports-aware resolvers understand the bare `/umd` subpath — raw CDN URLs need the full path. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Pushed 3ed2298 addressing all review comments — replies in the threads. One extra fix I made while in there, not from a review comment: the CDN URLs in the example were wrong.
|
|
LGTM |
Adds an "Install via UMD build" section to the Web SDK installation page, covering how to load the SDK from plain
<script>tags via browser globals, without a bundler — complementing the existing npm and ESM/CDN options.Tested locally with
yarn build.Note for reviewers: the UMD build ships in 8.6.0 (SDC-31903, fix version
8.6.0-beta.1). It is not in 8.5.x — verified not cherry-picked torelease/8.5— so the/umdCDN paths in the example won't resolve until 8.6.0 is released. Please don't publish this page before the 8.6.0 release.Closes SDC-32633