@@ -252,15 +252,29 @@ class SentryScenarioGenerationPlugin {
252252 [ 'feedback-modal' , 'feedback-screenshot' ] . forEach ( integration => {
253253 const fileName = `${ integration } .bundle.js` ;
254254
255- // We add the files, but not a script tag - they are lazy-loaded
256- symlinkAsset (
257- path . resolve (
258- PACKAGES_DIR ,
259- 'feedback' ,
260- BUNDLE_PATHS [ 'feedback' ] ?. [ integrationBundleKey ] ?. replace ( '[INTEGRATION_NAME]' , integration ) || '' ,
261- ) ,
262- path . join ( this . localOutPath , fileName ) ,
255+ // Lazy loading always requests .min.js files, so we need to use bundle_min
256+ // to get the .min.js version, even if the main bundle is not minified
257+ const feedbackBundleKey = integrationBundleKey === 'bundle' ? 'bundle_min' : integrationBundleKey ;
258+
259+ const bundlePath = BUNDLE_PATHS [ 'feedback' ] ?. [ feedbackBundleKey ] ?. replace (
260+ '[INTEGRATION_NAME]' ,
261+ integration ,
263262 ) ;
263+ if ( ! bundlePath ) {
264+ throw new Error (
265+ `Could not find bundle path for feedback integration "${ integration } " with bundle key "${ feedbackBundleKey } " (derived from "${ bundleKey } ")` ,
266+ ) ;
267+ }
268+
269+ const originalPath = path . resolve ( PACKAGES_DIR , 'feedback' , bundlePath ) ;
270+ if ( ! fs . existsSync ( originalPath ) ) {
271+ throw new Error (
272+ `Feedback bundle file does not exist: ${ originalPath } . Make sure to run 'yarn build:bundle' in packages/feedback first.` ,
273+ ) ;
274+ }
275+
276+ // We add the files, but not a script tag - they are lazy-loaded
277+ symlinkAsset ( originalPath , path . join ( this . localOutPath , fileName ) ) ;
264278 } ) ;
265279 }
266280
@@ -279,14 +293,46 @@ class SentryScenarioGenerationPlugin {
279293 ) ;
280294
281295 if ( integration === 'feedback' ) {
282- symlinkAsset (
283- path . resolve ( PACKAGES_DIR , 'feedback' , 'build/bundles/feedback-modal.js' ) ,
284- path . join ( this . localOutPath , 'feedback-modal.bundle.js' ) ,
296+ // Lazy loading always requests .min.js files, so we need to use bundle_min
297+ // to get the .min.js version, even if the main bundle is not minified
298+ const feedbackBundleKey = integrationBundleKey === 'bundle' ? 'bundle_min' : integrationBundleKey ;
299+
300+ const modalBundlePath = BUNDLE_PATHS [ 'feedback' ] ?. [ feedbackBundleKey ] ?. replace (
301+ '[INTEGRATION_NAME]' ,
302+ 'feedback-modal' ,
285303 ) ;
286- symlinkAsset (
287- path . resolve ( PACKAGES_DIR , 'feedback' , 'build/bundles/feedback-screenshot.js' ) ,
288- path . join ( this . localOutPath , 'feedback-screenshot.bundle.js' ) ,
304+ if ( ! modalBundlePath ) {
305+ throw new Error (
306+ `Could not find bundle path for feedback-modal with bundle key "${ feedbackBundleKey } " (derived from "${ bundleKey } ")` ,
307+ ) ;
308+ }
309+
310+ const modalOriginalPath = path . resolve ( PACKAGES_DIR , 'feedback' , modalBundlePath ) ;
311+ if ( ! fs . existsSync ( modalOriginalPath ) ) {
312+ throw new Error (
313+ `Feedback modal bundle file does not exist: ${ modalOriginalPath } . Make sure to run 'yarn build:bundle' in packages/feedback first.` ,
314+ ) ;
315+ }
316+
317+ const screenshotBundlePath = BUNDLE_PATHS [ 'feedback' ] ?. [ feedbackBundleKey ] ?. replace (
318+ '[INTEGRATION_NAME]' ,
319+ 'feedback-screenshot' ,
289320 ) ;
321+ if ( ! screenshotBundlePath ) {
322+ throw new Error (
323+ `Could not find bundle path for feedback-screenshot with bundle key "${ feedbackBundleKey } " (derived from "${ bundleKey } ")` ,
324+ ) ;
325+ }
326+
327+ const screenshotOriginalPath = path . resolve ( PACKAGES_DIR , 'feedback' , screenshotBundlePath ) ;
328+ if ( ! fs . existsSync ( screenshotOriginalPath ) ) {
329+ throw new Error (
330+ `Feedback screenshot bundle file does not exist: ${ screenshotOriginalPath } . Make sure to run 'yarn build:bundle' in packages/feedback first.` ,
331+ ) ;
332+ }
333+
334+ symlinkAsset ( modalOriginalPath , path . join ( this . localOutPath , 'feedback-modal.bundle.js' ) ) ;
335+ symlinkAsset ( screenshotOriginalPath , path . join ( this . localOutPath , 'feedback-screenshot.bundle.js' ) ) ;
290336 }
291337
292338 const integrationObject = createHtmlTagObject ( 'script' , {
0 commit comments