@@ -40,6 +40,12 @@ const BUNDLE_PATHS: Record<string, Record<string, string>> = {
40
40
bundle_es6 : 'build/bundles/[INTEGRATION_NAME].js' ,
41
41
bundle_es6_min : 'build/bundles/[INTEGRATION_NAME].min.js' ,
42
42
} ,
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
+ } ,
43
49
} ;
44
50
45
51
/*
@@ -87,6 +93,7 @@ function generateSentryAlias(): Record<string, string> {
87
93
class SentryScenarioGenerationPlugin {
88
94
public requiresTracing : boolean = false ;
89
95
public requiredIntegrations : string [ ] = [ ] ;
96
+ public requiresReplay = false ;
90
97
91
98
private _name : string = 'SentryScenarioGenerationPlugin' ;
92
99
@@ -99,6 +106,7 @@ class SentryScenarioGenerationPlugin {
99
106
'@sentry/browser' : 'Sentry' ,
100
107
'@sentry/tracing' : 'Sentry' ,
101
108
'@sentry/integrations' : 'Sentry.Integrations' ,
109
+ '@sentry/replay' : 'Sentry.Integrations' ,
102
110
}
103
111
: { } ;
104
112
@@ -113,6 +121,8 @@ class SentryScenarioGenerationPlugin {
113
121
this . requiresTracing = true ;
114
122
} else if ( source === '@sentry/integrations' ) {
115
123
this . requiredIntegrations . push ( statement . specifiers [ 0 ] . imported . name . toLowerCase ( ) ) ;
124
+ } else if ( source === '@sentry/replay' ) {
125
+ this . requiresReplay = true ;
116
126
}
117
127
} ,
118
128
) ;
@@ -140,6 +150,14 @@ class SentryScenarioGenerationPlugin {
140
150
data . assetTags . scripts . unshift ( integrationObject ) ;
141
151
} ) ;
142
152
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
+
143
161
data . assetTags . scripts . unshift ( bundleObject ) ;
144
162
}
145
163
0 commit comments