Snappy UIs with WebAssembly and Web Workers
Web Workers are a really great feature for performance. The way they want the worker code to live in a separate file makes them slightly annoying if you&#x27;re using a bundler, but each bundler has a loader or similar feature for this, so all is mostly well.<p>But the thing I haven&#x27;t found a solution for is, the case where you want to use web workers inside a library that other people will be importing into their own project, and you don&#x27;t know what bundler they&#x27;ll use (or transpiler, minifier, etc). I can think of hairy ways to do it, that involve pre-building the worker JS and storing that text in your library, piping it into a file blob at runtime, or the like. But does anyone know a clean way of handling this?