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() {
|
async function ensureEsbuildInitialized() {
|
||||||
if (esbuildInitialized === false) {
|
if (esbuildInitialized === false) {
|
||||||
if (Deno.run === undefined) {
|
if (Deno.run === undefined) {
|
||||||
esbuildInitialized = esbuild.initialize({
|
const wasmURL = new URL("./esbuild_v0.14.51.wasm", import.meta.url).href;
|
||||||
wasmURL: new URL("./esbuild_v0.14.51.wasm", import.meta.url).href,
|
esbuildInitialized = fetch(wasmURL).then(async (r) => {
|
||||||
worker: false,
|
const resp = new Response(r.body, {
|
||||||
|
headers: { "Content-Type": "application/wasm" },
|
||||||
|
});
|
||||||
|
const wasmModule = await WebAssembly.compileStreaming(resp);
|
||||||
|
await esbuild.initialize({
|
||||||
|
wasmModule,
|
||||||
|
worker: false,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
esbuild.initialize({});
|
esbuild.initialize({});
|
||||||
|
|||||||
Reference in New Issue
Block a user