deepkit-framework icon indicating copy to clipboard operation
deepkit-framework copied to clipboard

type-compiler for SWC

Open igl opened this issue 3 years ago • 4 comments

Is there a plan for a SWC plugin?

We phased out tsc a long time ago and replaced it with babel. Now we toy with SWC and also migrate to next-12 using swc. Going back to tsc is not really an option nor favourable for large projects.

Cool approach though, reminds me of the good times creating RPCs with flow runtime

igl avatar Mar 24 '22 12:03 igl

We use a few key methods of the TypeScript compiler API (for example to resolve types or module import expressions) to be able to correctly embed type informations as bytecode. I just saw that SWC supports plugins https://swc.rs/docs/usage/plugins, but I'm not sure if it provides all the necessary functions we need to have all type information available.

While I don't necessarily agree that tsc is not an option for large projects anymore (Deepkit is large as well and works well with tsc), I definitely see advantage of having a faster compiler. I guess if demand increases we should find out if we could build a SWC plugin for Deepkit and if its possible we should do it.

marcj avatar Mar 24 '22 14:03 marcj

I would put esbuild in this same boat, especially since it has largely the same problem and is becoming increasing popular.

RichiCoder1 avatar Jun 16 '22 02:06 RichiCoder1

We have "loader" capability now in master since https://github.com/deepkit/deepkit-framework/commit/30939492b96fd90d027728fc7a3030e8d8d24bf3. We can try to test SWC/esbuild now using https://github.com/deepkit/deepkit-framework/blob/master/packages/type-compiler/src/loader.ts

marcj avatar Jun 20 '22 01:06 marcj

We have "loader" capability now in master since 3093949. We can try to test SWC/esbuild now using https://github.com/deepkit/deepkit-framework/blob/master/packages/type-compiler/src/loader.ts

how do i use it in esbuild?

iceKing74 avatar Feb 02 '23 03:02 iceKing74