Tracking errors before JS bundle loads?

I use Sentry with a single-page app (Vue/React etc) and Sentry only loads after the main bundle is parsed and loaded. This means that any errors before the bundle loads don’t get tracked.

I posted about the issue on Stack Overflow but didn’t find a solution.

In general, how am I supposed to use log errors to Sentry before the main JS bundle loads?