3 ms·
I'm wondering if it would be useful/possible to run the compilation in a service worker that would intercept requests for *.ts and compile them in the worker?
by Tade0 1y ago
I'm wondering if it would be useful/possible to run the compilation in a service worker that would intercept requests for *.ts and compile them in the worker?
I've seen an alternative approach, where the TS code is sent for compilation to a dedicated server - dismissed that idea as over engineered, but then I learned that the swc WASM package clocks in at over 5MB.
I love the name BTW.
- carl_dr 1y agoThat is how this works. > tsbro solves this by completely bypassing the browser's import system using synchronous XHR, transpile with swc wasm and a sophisticated ESM-to-CJS transpiler so that synchronous require is used everywhere:
- Tade0 1y agoYes, but it's doing all that locally. When I ran the code it downloaded a 5MB file, namely https://esm.sh/@swc/wasm-web@1.13.2/wasm_bg.wasm https://esm.sh/@swc/wasm-web@1.13.2/wasm_bg.wasm. It's also not using a service worker.