Skip to main content
Module

x/ts_serve/mod.ts>fourceInstantiateWasm

Transpile TypeScript on the fly and deliver it from your server as ES Modules.
Latest
function fourceInstantiateWasm
import { fourceInstantiateWasm } from "https://deno.land/x/ts_serve@v1.4.4/mod.ts";

Calling this function will load the wasm file used in the deno_emit of the dependency. Even if you don't call this function, if you call the transpile function, the wasm file will be read automatically at that timing. However, performance can be an issue on the server as loading the wasm file takes time. In that case, calling this function in advance can speed up later calls to the transpile function.

import { serve } from "https://deno.land/std@0.177.0/http/mod.ts";
import { serveDirWithTs, fourceInstantiateWasm } from "https://deno.land/x/ts_serve@v1.4.4/mod.ts";

// load the wasm file in the background when the server starts.
fourceInstantiateWasm();
serve((request) => serveDirWithTs(request));