Google Analytics for example lets you push everything you want to record into a plain global array called "ga", and when the library loads, everything in the array in processed by the library. This lets you start capturing events without waiting for the library to load.
Why? Can't you push the Error object or stack trace into an array to await processing?
[0] https://developer.mozilla.org/en-US/docs/Web/API/GlobalEvent...
I added a pretty barebones “report js errors to the backend” script in about 1.1k uncompressed/unminified.
It’s possible it doesn’t catch all errors I guess but I can’t imagine what 56K of js just to catch and reports is doing.
I’d say probably 99% of the error reports we see from it are a third party js script not loading (Sometimes a network issue, sometimes a plugin blocks them) we’ve pared third party loads down to just the payment gateways, but they’re still the vast majority of reports we see).
However it’s also not js heavy, so that type of error logging solution works well for us.
I don't get sourcemap mapping, but I can send along enough metadata to find the issue in most cases,
I use Sentry on one site but it has a 56K library you have to load before any of your JavaScript loads, so bad for page size + bad for page blocking. I would have thought they'd at least let you use a shim to capture errors quickly while you defer loading the full library (like how Google Analytics does it) but I can't see an obvious way to do that.
Sentry has really nice features but 56K (17K compressed) is a big chunk when I'm trying to keep a page to about 100K transferred.