>( + component: React.ComponentType
, + ): React.ComponentType
=> component,
+}
diff --git a/src/logger/sentry/setup/index.web.ts b/src/logger/sentry/setup/index.web.ts
new file mode 100644
index 000000000..a927321b0
--- /dev/null
+++ b/src/logger/sentry/setup/index.web.ts
@@ -0,0 +1,51 @@
+import {init} from '@sentry/browser'
+
+import * as env from '#/env'
+
+/*
+ * Web counterpart of ./index.ts. Initializing `@sentry/browser` directly
+ * instead of `@sentry/react-native` keeps the RN SDK layer (native wrapper,
+ * RN tracing, feedback widget, RN integrations - roughly 200KB minified) out
+ * of the web bundle. Options mirror the native setup; RN-only options are
+ * omitted.
+ */
+init({
+ enabled: !env.IS_DEV && !!env.SENTRY_DSN,
+ dsn: env.SENTRY_DSN,
+ debug: false, // If `true`, Sentry will try to print out useful debugging information if something goes wrong with sending the event. Set it to `false` in production
+ environment: env.ENV,
+ dist: env.BUNDLE_IDENTIFIER,
+ release: env.RELEASE_VERSION,
+ ignoreErrors: [
+ /*
+ * Unknown internals errors
+ */
+ `t is not defined`,
+ `Can't find variable: t`,
+ /*
+ * Un-useful errors
+ */
+ `Network request failed`,
+ ],
+ /**
+ * Does not affect traces of error events or other logs, just disables
+ * automatically attaching stack traces to events. This helps us group events
+ * and prevents explosions of separate issues.
+ *
+ * @see https://docs.sentry.io/platforms/react-native/configuration/options/#attach-stacktrace
+ */
+ attachStacktrace: false,
+ sampleRate: env.IS_INTERNAL ? 1.0 : 0.1,
+ /**
+ * Sample rate for performance spans (video playback, video upload). Setting
+ * this also enables the SDK's default stall and slow/frozen frame tracking,
+ * whose measurements attach to every root span.
+ */
+ tracesSampleRate: env.IS_INTERNAL ? 1.0 : 0.01,
+ /*
+ * The native setup passes `enableAutoSessionTracking: false`. The browser
+ * SDK's equivalent is the BrowserSession default integration, so filter it
+ * out to match.
+ */
+ integrations: defaults => defaults.filter(i => i.name !== 'BrowserSession'),
+})
diff --git a/src/platform/polyfills.web.ts b/src/platform/polyfills.web.ts
index dce9b284c..53d786c7f 100644
--- a/src/platform/polyfills.web.ts
+++ b/src/platform/polyfills.web.ts
@@ -1,34 +1,12 @@
import 'array.prototype.findlast/auto'
import 'setimmediate'
-if (process.env.NODE_ENV !== 'production') {
- // In development, react-native-web's