Bundle Size Impact
Typical bundle sizes (gzipped):- Browser SDK (minimal): ~25 KB
- Browser SDK (with integrations): ~35-45 KB
- Node SDK: Not relevant for frontend bundles
- Framework SDKs: Similar to Browser SDK + framework-specific code
Tree-Shaking
Modern bundlers automatically remove unused code:Selective Integration Loading
Minimal SDK
Disable default integrations and add only what you need:Conditional Integration Loading
Load heavy integrations only when needed:Lazy Loading Sentry
Load Sentry asynchronously to improve initial page load:Smart Lazy Loading
Load immediately on errors, lazily otherwise:CDN Loading
Use the Sentry CDN bundle to avoid bundling:Available CDN Bundles
Framework-Specific Optimizations
React
Only import what you need:Next.js
Next.js SDK is optimized automatically:Vue
Bundler Configuration
Webpack
Optimize tree-shaking:Vite
Vite optimizes automatically, but you can verify:Rollup
Feature Flags for Bundle Size
Disable Debug Code in Production
The SDK includes debug code that’s stripped in production:Environment-Based Loading
Measuring Bundle Size
webpack-bundle-analyzer
Vite Plugin Visualizer
Bundle Size Limit
Set size limits to prevent regressions:Integration Size Reference
Approximate sizes (gzipped):Best Practices
Audit integrations regularly
Audit integrations regularly
Review which integrations you’re using and remove unused ones:
Use code splitting for heavy features
Use code splitting for heavy features
Load heavy integrations dynamically:
Consider CDN for prototyping
Consider CDN for prototyping
During development, use CDN bundles to avoid build config:Switch to npm package for production for better bundling control.
Monitor bundle size in CI
Monitor bundle size in CI
Add bundle size checks to prevent regressions:
Don't over-optimize at the expense of functionality
Don't over-optimize at the expense of functionality
The SDK’s impact is usually minimal. Removing error reporting to save 25 KB is rarely worth it.
Complete Minimal Example
Production-Optimized Example
Next Steps
Source Maps
Configure source maps for production
Performance Monitoring
Optimize performance monitoring