PostHog / posthog-js

Send usage data from your web app or site to PostHog, with autocapture.
https://posthog.com/docs/libraries/js
Other
299 stars 125 forks source link

fix: some clients need web vitals directly on window #1406

Closed pauldambra closed 2 months ago

pauldambra commented 2 months ago

In #1401 we moved the web vitals callbacks onto an object on the window instead of placing them directly on the window... there are more and more extensions being added on to the window - and that is no bueno

but, existing clients installed with npm may now request web vitals and look for it directly on the window but it isn't there any more - also no bueno

we can't fix this in the main bundle since its only old clients and they won't have that code, so it has to be fixed in the entrypoint file - which is what generates the web vitals file the old clients are lazily loading

vercel[bot] commented 2 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
posthog-js ✅ Ready (Inspect) Visit Preview Sep 9, 2024 6:24pm
github-actions[bot] commented 2 months ago

Size Change: +64 B (+0.01%)

Total Size: 1.19 MB

Filename Size Change
dist/array.full.js 341 kB +32 B (+0.01%)
dist/web-vitals.js 10.3 kB +32 B (+0.31%)
ℹ️ View Unchanged | Filename | Size | | :--- | :---: | | `dist/array.js` | 157 kB | | `dist/exception-autocapture.js` | 10.4 kB | | `dist/main.js` | 157 kB | | `dist/module.js` | 157 kB | | `dist/recorder-v2.js` | 110 kB | | `dist/recorder.js` | 111 kB | | `dist/surveys-preview.js` | 59.8 kB | | `dist/surveys.js` | 66 kB | | `dist/tracing-headers.js` | 8.26 kB |

compressed-size-action

brunomguimaraes commented 2 months ago

Thanks for this change @pauldambra !