{"id":15625750,"url":"https://github.com/daniel15/lazysentry","last_synced_at":"2025-04-28T15:52:56.660Z","repository":{"id":139345516,"uuid":"410428249","full_name":"Daniel15/LazySentry","owner":"Daniel15","description":"Example code to lazy load Sentry using ES2020 import()","archived":false,"fork":false,"pushed_at":"2021-12-02T06:47:24.000Z","size":9,"stargazers_count":14,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-28T15:52:50.852Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Daniel15.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-09-26T02:20:09.000Z","updated_at":"2024-02-26T03:59:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"8c8a835f-ce65-43ef-8e77-dba4a148fad8","html_url":"https://github.com/Daniel15/LazySentry","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Daniel15%2FLazySentry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Daniel15%2FLazySentry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Daniel15%2FLazySentry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Daniel15%2FLazySentry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Daniel15","download_url":"https://codeload.github.com/Daniel15/LazySentry/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251342718,"owners_count":21574243,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-03T10:02:45.747Z","updated_at":"2025-04-28T15:52:56.631Z","avatar_url":"https://github.com/Daniel15.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LazySentry\n\nThis is some code I use to lazy-load the [Sentry JavaScript SDKs](https://github.com/getsentry/sentry-javascript/), including a basic lazy-loaded React `ErrorBoundary`. Currently, Sentry's JavaScript SDK is [very large](https://github.com/getsentry/sentry-javascript/issues/2707). They have built-in basic lazy loading support, however it [does not work for on-premise installations](https://github.com/getsentry/sentry/issues/22715), and also does not support the tight React integration via an ErrorBoundary.\n\nUntil the bundle size is reduced ([as part of v7 of the SDK](https://github.com/getsentry/sentry-javascript/issues/2817)), lazy-loading the SDK can at least defer the cost a bit.\n\n# Files in this repo\n\n- `LazySentryImports`: The actual parts of the Sentry module that we want to use\n- `LazySentry`: Handles loading Sentry. If Sentry has not been loaded yet, the functions (eg. `captureException`) are buffered in a queue. Once the Sentry library is loaded, all the buffered calls are replayed\n- `LazySentryErrorBoundary`: React ErrorBoundary that handles a lazy-loaded Sentry SDK\n\n# Usage\n\n- Use `LazySentry` instead of `@sentry/browser` or `@sentry/react` in your code.\n- Call `init` at some appropriate time, such as after your app has loaded all its main code, or in a `requestIdleCallback` callback.\n- If you want to use more features from Sentry, add them to `LazySentryImports` then add wrappers for them in `LazySentry`.\n\n# Example\n\nThis code snippet is used in the Sentry initialisation code on dnstools.ws: https://github.com/Daniel15/dnstools/blob/master/src/DnsTools.Web/ClientApp/src/index.tsx. The LazySentry repo is configured as a Git submodule. \n\n# Support\n\nThere is no warranty nor any support provided for the code in this repository.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaniel15%2Flazysentry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaniel15%2Flazysentry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaniel15%2Flazysentry/lists"}