Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(v7/browser): Add moduleMetadataIntegration lazy loading support #13822

Merged
merged 4 commits into from
Nov 11, 2024

Conversation

gilisho
Copy link
Contributor

@gilisho gilisho commented Sep 27, 2024

This PR fixes #13803. The corresponding PR for latest major version is #13817.

I saw the bundles generation for integration is happening in @sentry/integrations, so I added a corresponding file for modulemetadata in this package that exports that integration from @sentry/core, so that the bundle actually gets created for this integration as needed.

@mydea
Copy link
Member

mydea commented Oct 7, 2024

I am not 100% sure if it is necessary to backport this to v7 - IMHO this is specialised enough that it appears OK to me to not have this in v7? Especially since lazyLoadIntegration is not available there at all. Do you need this in v7?

@gilisho
Copy link
Contributor Author

gilisho commented Oct 7, 2024

Currently my platform is in v7 (we initially were in v5 so migrating to v8 is going to be impossible ATM), so I do need it in v7 as well.
I want to load the integration's bundle and do:

    if (window.Sentry.moduleMetadataIntegration) {
      Sentry.addIntegration(Sentry.moduleMetadataIntegration());
    }

inside window.sentryOnLoad. Without it in v7, the micro-frontend solution would be unusable when using loader script in v7. Maybe lazy loading is an incorrect term for v7, but there's still a need for a bundle for this integration.

@mydea
Copy link
Member

mydea commented Oct 8, 2024

OK, I see, that's fine.

Then, instead of having this in @sentry/integrations, I would generate this from the browser package:

  1. Create an entry point there for the integration in packages/browser/src/integrations/modulemetadata.ts
  2. Add an addon bundle for this in https://github.com/getsentry/sentry-javascript/blob/v7/packages/browser/rollup.bundle.config.mjs, similar to https://github.com/getsentry/sentry-javascript/blob/v7/packages/browser/rollup.bundle.config.mjs#L28

@gilisho
Copy link
Contributor Author

gilisho commented Nov 11, 2024

Hi @mydea! Could you take a look at this PR as well? This is the correspondent PR of #13817 for v7.

@mydea mydea changed the title feat(browser): [v7] Add moduleMetadataIntegration lazy loading support feat(v7/browser): Add moduleMetadataIntegration lazy loading support Nov 11, 2024
@gilisho gilisho requested a review from mydea November 11, 2024 12:24
@mydea mydea merged commit 0cb1a4e into getsentry:v7 Nov 11, 2024
65 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants