Commit 3e90673
authored
feat: publish umd for broser environments (#334)
## Summary
Creates a umd build for unpkg and other browser script installations.
## How did you test this change?
```html
<html>
<head>
<script type="text/javascript" src="https://unpkg.com/[email protected]"></script>
<script type="text/javascript" src="https://unpkg.com/@launchdarkly/[email protected]"></script>
<script type="text/javascript" src="https://unpkg.com/@launchdarkly/[email protected]"></script>
<script>
const context = {
type: 'user',
key: '[email protected]'
};
window.ld =
window.LDClient.initialize('YOUR_LD_CLIENT_ID', context, {
plugins: [
new window.Observability.default({
tracingOrigins: true,
networkRecording: {
enabled: true,
recordHeadersAndBody: true
}
}),
new window.SessionReplay.default({
privacySetting: 'none',
})
]
});
</script>
</head>
<body>
yooo
</body>
</html>
```
https://github.com/launchdarkly/observability-sdk/actions/runs/20444345338
<img width="1793" height="442" alt="Screenshot 2025-12-22 at 13 21 07"
src="https://github.com/user-attachments/assets/648aae06-2d3f-4f7d-8383-41f4499acd9b"
/>
## Are there any deployment considerations?
<!--
Backend - Do we need to consider migrations or backfilling data?
-->
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Enables browser/CDN script usage by publishing UMD bundles alongside
ES builds for both `@launchdarkly/observability` and
`@launchdarkly/session-replay`.
>
> - Build: Vite now outputs `umd` and `es` formats with named globals
(`Observability`, `SessionReplay`) and consistent filenames (`index.js`,
`index.umd.js`)
> - Packaging: `package.json` switches `main`/`module` to
`./dist/index.js` and adds `unpkg`/`jsdelivr` pointing to
`./dist/index.umd.js`
> - Version: bump both packages to `0.4.12-alpha.1`
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
c921ab0. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent bf70e18 commit 3e90673
File tree
4 files changed
+38
-14
lines changed- sdk/@launchdarkly
- observability
- session-replay
4 files changed
+38
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
41 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
42 | 44 | | |
43 | 45 | | |
44 | 46 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
| 12 | + | |
12 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
13 | 18 | | |
14 | 19 | | |
15 | 20 | | |
16 | 21 | | |
17 | 22 | | |
18 | 23 | | |
19 | | - | |
20 | | - | |
21 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
22 | 32 | | |
23 | 33 | | |
24 | 34 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
38 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
39 | 41 | | |
40 | 42 | | |
41 | 43 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
| 12 | + | |
12 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
13 | 18 | | |
14 | 19 | | |
15 | 20 | | |
16 | 21 | | |
17 | 22 | | |
18 | 23 | | |
19 | | - | |
20 | | - | |
21 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
22 | 32 | | |
23 | 33 | | |
24 | 34 | | |
| |||
0 commit comments