Skip to content

Commit

Permalink
feat(v7/browser): Add moduleMetadataIntegration lazy loading support (#…
Browse files Browse the repository at this point in the history
…13822)

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.
  • Loading branch information
gilisho authored Nov 11, 2024
1 parent 9b3ec19 commit 0cb1a4e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ const IMPORTED_INTEGRATION_CDN_BUNDLE_PATHS: Record<string, string> = {
ReportingObserver: 'reportingobserver',
sessionTimingIntegration: 'sessiontiming',
SessionTiming: 'sessiontiming',
moduleMetadataIntegration: 'modulemetadata',
ModuleMetadata: 'modulemetadata',
};

const BUNDLE_PATHS: Record<string, Record<string, string>> = {
Expand Down
9 changes: 9 additions & 0 deletions packages/browser/rollup.bundle.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,19 @@ targets.forEach(jsVersion => {
outputFileBase: () => `bundles/browserprofiling${jsVersion === 'es5' ? '.es5' : ''}`,
});

const moduleMetadataAddonBaseBundleConfig = makeBaseBundleConfig({
bundleType: 'addon',
entrypoints: ['src/integrations/modulemetadata.ts'],
jsVersion,
licenseTitle: '@sentry/browser',
outputFileBase: () => `bundles/modulemetadata${jsVersion === 'es5' ? '.es5' : ''}`,
});

builds.push(
...makeBundleConfigVariants(baseBundleConfig),
...makeBundleConfigVariants(tracingBaseBundleConfig),
...makeBundleConfigVariants(browserProfilingAddonBaseBundleConfig),
...makeBundleConfigVariants(moduleMetadataAddonBaseBundleConfig),
);
});

Expand Down
2 changes: 2 additions & 0 deletions packages/browser/src/integrations/modulemetadata.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/* eslint-disable deprecation/deprecation */
export { moduleMetadataIntegration, ModuleMetadata } from '@sentry/core';

0 comments on commit 0cb1a4e

Please sign in to comment.