Closed yousif-bugsnag closed 11 months ago
NPM build
Package | |
---|---|
Before | 175.95 kB |
After | 177.45 kB |
± | +1,497 bytes ⚠️ |
CDN build
Unminified | Minfied | Minified + gzipped | |
---|---|---|---|
Before | 84.94 kB |
31.99 kB |
9.84 kB |
After | 85.98 kB |
32.33 kB |
9.93 kB |
± | +1,039 bytes ⚠️ |
+335 bytes ⚠️ |
+91 bytes ⚠️ |
Ok | File (✨=New File) | Lines | Branches | Functions | Statements |
---|---|---|---|---|---|
🔴 | /home/runner/work/bugsnag-js-performance/bugsnag-js-performance/packages/platforms/browser/lib/browser.ts | 87.5% (-8.92%) |
75% (-25%) |
50% (+0%) |
87.5% (-8.92%) |
🔴 | /home/runner/work/bugsnag-js-performance/bugsnag-js-performance/packages/platforms/browser/lib/default-routing-provider.ts | 100% (+0%) |
60% (-15%) |
100% (+0%) |
100% (+0%) |
Total:
Lines | Branches | Functions | Statements |
---|---|---|---|
92.06%(-0.15%) | 80.9%(-0.2%) | 93.98%(+0.09%) | 90.13%(-0.11%) |
Generated against d18dca8edb8e208dbbca83648bef93afe7bafc0d on 2 January 2024 at 10:29:11 UTC
Goal
Prevent the SDK from crashing when used in SSR frameworks such as Next or Nuxt.
Currently
window
anddocument
are accessed when the library is imported which causes a crash when the code is executed server-side as these are not defined.This PR aims to prevent this and allow the SDK to be used in SSR apps, by exporting a noop client, onSettle and routing provider if
window
anddocument
are undefined.Testing
Added unit tests for the onSettle and routing provider noops, and tested manually with a Next.js app