From 7b09bcec208d188abea2d96595e0c7b9dd2fd1dd Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Mon, 28 Jul 2025 17:42:55 +0200 Subject: [PATCH] fix(core): Make `moduleMetadata` injection snippet fully ES5-compliant --- packages/bundler-plugin-core/src/utils.ts | 2 +- .../bundler-plugin-core/test/__snapshots__/utils.test.ts.snap | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/bundler-plugin-core/src/utils.ts b/packages/bundler-plugin-core/src/utils.ts index 62dc2a5b..138f5b31 100644 --- a/packages/bundler-plugin-core/src/utils.ts +++ b/packages/bundler-plugin-core/src/utils.ts @@ -334,7 +334,7 @@ export function generateModuleMetadataInjectorCode(metadata: any): string { // The code below is mostly ternary operators because it saves bundle size. // The checks are to support as many environments as possible. (Node.js, Browser, webworkers, etc.) // We are merging the metadata objects in case modules are bundled twice with the plugin - return `!function(){var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[(new e.Error).stack]=Object.assign({},e._sentryModuleMetadata[(new e.Error).stack],${JSON.stringify( + return `!function(){var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[(new e.Error).stack]=function(e){for(var n=1;n