You can move your task to a web-worker, so your CPU intensive tasks don't block the main thread.
Workers are not difficult to use by themselves, but libraries like greenlet (useful for very small functions), comlink (Bidirectional RPC between worker and main thread) and clooney (Actor library built on top of comlink) can make application code a lot simpler.
I recently wrote a post about integrating comlink, worker-loader and typescript.