restore bundle optimisations from webpack

This commit is contained in:
Samuel Newman
2026-05-25 18:45:24 +03:00
parent d32f926989
commit 0f55e383f1
+14
View File
@@ -14,6 +14,17 @@ if (cfg.resolver.resolveRequest) {
// Enforce "no RNGH on web" // Enforce "no RNGH on web"
cfg.resolver.blockList = [/react-native-gesture-handler\/.*/] cfg.resolver.blockList = [/react-native-gesture-handler\/.*/]
// Stub out unused Sentry integrations. They're statically imported by
// @sentry/browser's barrel, so we can't drop them via blockList; we redirect
// the imports to an empty module instead. ~185KB of dead weight on web.
const STUBBED_PACKAGES = new Set([
'@sentry-internal/replay',
'@sentry-internal/replay-canvas',
'@sentry-internal/feedback',
])
const emptyModulePath =
require.resolve('metro-runtime/src/modules/empty-module.js')
if (process.env.BSKY_PROFILE) { if (process.env.BSKY_PROFILE) {
cfg.cacheVersion += ':PROFILE' cfg.cacheVersion += ':PROFILE'
} }
@@ -30,6 +41,9 @@ cfg.resolver.resolveRequest = (context, moduleName, platform) => {
) )
} }
} }
if (platform === 'web' && STUBBED_PACKAGES.has(moduleName)) {
return {type: 'sourceFile', filePath: emptyModulePath}
}
return context.resolveRequest(context, moduleName, platform) return context.resolveRequest(context, moduleName, platform)
} }