-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(cli): Use swc for deno bundle #7461
Conversation
It works well. I tested (Command: But I didn't write tests yet because I have to look for file fetcher and module graph. |
CC @kitsonk could you take a look? |
Finally have gotten some time to look at this. I rebased it off master, and took it for a spin. I am getting the following with this:
I suspect it is related to the fact that most of the code is on This also seems to suffer from #3802:
There are other tests I would like to do to see how much of #4549 this would fix or make unneeded to address, but a few thoughts/observations:
My overall opinion is that I would love to take this PR and fold it into the compiler rewrite. Specifically adapt this as the next PR after #7621. |
I was actually thinking it might be better to make it as an off-by-default flag. |
Possibly, but that is a significant change in behaviour. It was discussed in #5436 and we agreed to type check by default. My personal opinion is that we wouldn't want to change that behaviour until Deno 2 at the earliest, even then, with the concept of a "secure" development tool, when using TypeScript, I would think people would expect it to type check by default. |
IMO tree shaking seems more important than type checking when bundling. |
@kitsonk I meant an option like --no-check (to use swc_bundler), which is off by default. |
There is no reason we can have both, and from a time perspective, it will be no worse than what we have today. |
Ah, using |
I recently made lots of progress. Type inference, including type parameter inference is almost done. Many type inference tests from official tsc passes, but I think more tests are required. See: swc-project/swc#571 Edit: After some debugging, I found it's related to circular dependencies. |
Closing in favor of #7669 |
To ease testing, I added codes to
cli/tsc.rs
.I'll move codes to relevant module after some testing.
Output of
deno bundle https://deno.land/[email protected]/http/server.ts
: https://gist.github.com/kdy1/fee62b5f2e6dcc4639e2f16277978ccdTimings are:
target/debug/deno bundle 'https://deno.land/[email protected]/http/server.ts' 0.24s user 0.02s system 96% cpu 0.266 total
target/release/deno bundle 'https://deno.land/[email protected]/http/server.ts' 0.03s user 0.01s system 80% cpu 0.052 total
I found another bug while testing it on other std modules. Fix seems simple, so I'll fix it asap.Fixed with swc-project/swc#1083.
I found a bug of `swc_bundler`, and working on it at https://github.com/swc-project/swc/pull/1075 (Circular import bug)Sadly I found some more bugs.