Alex Craft
Alex Craft

Reputation: 15356

How to pre-compile Deno script?

Executing deno run script.ts first time is slow, and the second time is faster.

Is there some pre-compile command, to compile and cache scripts, but don't run it?

Upvotes: 2

Views: 411

Answers (2)

mikeroelens
mikeroelens

Reputation: 21

You can compile a Deno script into a standalone binary using deno compile.

deno compile https://deno.land/std/examples/welcome.ts
./welcome # Run executable

Upvotes: 2

mfulton26
mfulton26

Reputation: 31254

You can fetch and compile modules into your local cache using deno cache script.ts.

You can also use deno cache --reload script.ts to invalidate the cache and then refetch and recompile.

Reference: Reloading modules | Manual | Deno

Upvotes: 3

Related Questions