ayame113 / ts-serve

Transpile TypeScript on the fly and deliver it from your server as ES Modules.
https://deno.land/x/ts_serve
MIT License
39 stars 2 forks source link

compile TypeScript folder in advance #32

Closed jiawei397 closed 1 year ago

jiawei397 commented 1 year ago

Is there any way to compile the target TypeScript folder in advance?

In addition, it would be better if you could control whether to generate sourcemap.

ayame113 commented 1 year ago

Is there any way to compile the target TypeScript folder in advance?

Lume, a static site generator, is probably the best choice for this purpose! The esbuild plugin allows you to compile any typescript you have in a folder in advance.

In addition, it would be better if you could control whether to generate sourcemap.

I'd like to do this, but first I need to resolve https://github.com/denoland/deno_emit/issues/29, an upstream issue. (please see also https://github.com/denoland/deno_emit/issues/83.)

jiawei397 commented 1 year ago

As for the first point, I mean how to pre-cache when using your tool library. If I use it in production, It is better precompile the ts file first. Because I found that one of my ts files, although not large, took 1 second for the first time, which may be a serious problem in production.

ayame113 commented 1 year ago

Because I found that one of my ts files, although not large, took 1 second for the first time

In that case, it may be taking a long time to read the wasm file. Why not try fourceInstantiateWasm function? (Sorry if you've already tried it.)

jiawei397 commented 1 year ago

Very good. This may be what I need.