fix: always use wasm content type for esbuild (#868)
This commit is contained in:
+10
-3
@@ -12,9 +12,16 @@ let esbuildInitialized: boolean | Promise<void> = false;
|
||||
async function ensureEsbuildInitialized() {
|
||||
if (esbuildInitialized === false) {
|
||||
if (Deno.run === undefined) {
|
||||
esbuildInitialized = esbuild.initialize({
|
||||
wasmURL: new URL("./esbuild_v0.14.51.wasm", import.meta.url).href,
|
||||
worker: false,
|
||||
const wasmURL = new URL("./esbuild_v0.14.51.wasm", import.meta.url).href;
|
||||
esbuildInitialized = fetch(wasmURL).then(async (r) => {
|
||||
const resp = new Response(r.body, {
|
||||
headers: { "Content-Type": "application/wasm" },
|
||||
});
|
||||
const wasmModule = await WebAssembly.compileStreaming(resp);
|
||||
await esbuild.initialize({
|
||||
wasmModule,
|
||||
worker: false,
|
||||
});
|
||||
});
|
||||
} else {
|
||||
esbuild.initialize({});
|
||||
|
||||
Reference in New Issue
Block a user