diff --git a/webpack.common.js b/webpack.common.js index fdd7f08e3..e806a824a 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -114,20 +114,29 @@ module.exports = (publicPath = "auto") => { process.env.SENTRY_AUTH_TOKEN && process.env.IS_SENTRY_ENABLED === "true" ) { - plugins.push( - sentryWebpackPlugin({ - org: "sentry", - project: "hyperswitch-react-sdk", - authToken: process.env.SENTRY_AUTH_TOKEN, - url: process.env.SENTRY_URL, - release: { - name: "0.2", - uploadLegacySourcemaps: { - paths: ["dist"], - }, - }, - }) - ); + if ( + process.env.SENTRY_AUTH_TOKEN && + process.env.IS_SENTRY_ENABLED === "true" + ) { + try { + plugins.push( + sentryWebpackPlugin({ + org: "sentry", + project: "hyperswitch-react-sdk", + authToken: process.env.SENTRY_AUTH_TOKEN, + url: process.env.SENTRY_URL, + release: { + name: "0.2", + uploadLegacySourcemaps: { + paths: ["dist"], + }, + }, + }) + ); + } catch (error) { + console.warn("Sentry Webpack Plugin initialization failed:", error); + } + } } return {