Skip to content

Commit

Permalink
cache wasm-web
Browse files Browse the repository at this point in the history
This improves start up time, I haven't benchmarked, but it definitely "feels" quicker.
  • Loading branch information
deckchairlabs authored Apr 24, 2022
1 parent 90713f5 commit 20601b1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,19 @@ import {
parseSync,
printSync,
Program,
toFileUrl,
transformSync,
} from "./deps.ts";
import { cache } from "https://deno.land/x/cache@0.2.13/mod.ts";
import { TransformOptions } from "./types.ts";
import { UltraVisitor } from "./ast/ultra.ts";
import { ImportMapResolver } from "./importMapResolver.ts";
import { VendorVisitor } from "./ast/vendor.ts";

await initSwc("https://cdn.esm.sh/@swc/wasm-web@1.2.165/wasm_bg.wasm");
const wasmFilepath = await cache(
"https://cdn.esm.sh/@swc/wasm-web@1.2.165/wasm_bg.wasm",
);
await initSwc(toFileUrl(wasmFilepath.path));

const parserOptions: ParseOptions = {
syntax: "typescript",
Expand Down

0 comments on commit 20601b1

Please sign in to comment.