getsentry / spotlight

Your Universal Debug Toolbar
https://spotlightjs.com
Other
377 stars 11 forks source link

ref: Optimize build configs and builds #480

Closed BYK closed 3 months ago

BYK commented 3 months ago

This change mainly removes the enforcement of process.env.NODE_ENV === 'development' for Spotlight which in turn also enables significant bundle size savings as we include the React library which does optimizations based on this value.

Without the patch:

File Size Gzipped Map
dist/sentry-spotlight.js 0.65 kB 0.39 kB 0.10 kB
dist/main-f821b601.js 163.24 kB 38.35 kB 267.29 kB
dist/index-122c6ab6.js 1,472.54 kB 455.16 kB 3,871.30 kB
dist/sentry-spotlight.iife.js 1,206.02 kB 437.51 kB 4,010.64 kB

With the patch:

File Size Gzipped Map
dist/sentry-spotlight.js 0.65 kB 0.39 kB 0.10 kB
dist/main-02efbde8.js 163.24 kB 38.35 kB 267.29 kB
dist/index-8591b57c.js 1,181.10 kB 384.51 kB 2,516.24 kB
dist/sentry-spotlight.iife.js 1,016.89 kB 380.25 kB 2,679.17 kB
vercel[bot] commented 3 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
spotlightjs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 7, 2024 3:29pm
BYK commented 3 months ago

The build changes look fine to me although I remember we had some issues with process for some reason ending up in client code and of course being undefined. I'm curious if the changes here solve this or if we'd regress. But to be honest, I didn't make these changes back then so can't tell you specifics unfortunately :/

For this, I rely on e2e tests as it should be caught there. That said I'll do another manual pass before merging to make sure this doesn't cause any issues. It may as well be solved with newer versions of vite too.