@@ -40,6 +40,12 @@ const BUNDLE_PATHS: Record<string, Record<string, string>> = {
4040 bundle_es6 : 'build/bundles/[INTEGRATION_NAME].js' ,
4141 bundle_es6_min : 'build/bundles/[INTEGRATION_NAME].min.js' ,
4242 } ,
43+ replay : {
44+ cjs : 'build/npm/cjs/index.js' ,
45+ esm : 'build/npm/esm/index.js' ,
46+ bundle_es6 : 'build/bundles/replay.js' ,
47+ bundle_es6_min : 'build/bundles/replay.min.js' ,
48+ } ,
4349} ;
4450
4551/*
@@ -87,6 +93,7 @@ function generateSentryAlias(): Record<string, string> {
8793class SentryScenarioGenerationPlugin {
8894 public requiresTracing : boolean = false ;
8995 public requiredIntegrations : string [ ] = [ ] ;
96+ public requiresReplay = false ;
9097
9198 private _name : string = 'SentryScenarioGenerationPlugin' ;
9299
@@ -99,6 +106,7 @@ class SentryScenarioGenerationPlugin {
99106 '@sentry/browser' : 'Sentry' ,
100107 '@sentry/tracing' : 'Sentry' ,
101108 '@sentry/integrations' : 'Sentry.Integrations' ,
109+ '@sentry/replay' : 'Sentry.Integrations' ,
102110 }
103111 : { } ;
104112
@@ -113,6 +121,8 @@ class SentryScenarioGenerationPlugin {
113121 this . requiresTracing = true ;
114122 } else if ( source === '@sentry/integrations' ) {
115123 this . requiredIntegrations . push ( statement . specifiers [ 0 ] . imported . name . toLowerCase ( ) ) ;
124+ } else if ( source === '@sentry/replay' ) {
125+ this . requiresReplay = true ;
116126 }
117127 } ,
118128 ) ;
@@ -140,6 +150,14 @@ class SentryScenarioGenerationPlugin {
140150 data . assetTags . scripts . unshift ( integrationObject ) ;
141151 } ) ;
142152
153+ if ( this . requiresReplay && BUNDLE_PATHS [ 'replay' ] [ bundleKey ] ) {
154+ const replayObject = createHtmlTagObject ( 'script' , {
155+ src : path . resolve ( PACKAGES_DIR , 'replay' , BUNDLE_PATHS [ 'replay' ] [ bundleKey ] ) ,
156+ } ) ;
157+
158+ data . assetTags . scripts . unshift ( replayObject ) ;
159+ }
160+
143161 data . assetTags . scripts . unshift ( bundleObject ) ;
144162 }
145163
0 commit comments