Skip to content
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

Running Bun on TSC fails #349

Closed
mikecann opened this issue Jul 7, 2022 · 15 comments
Closed

Running Bun on TSC fails #349

mikecann opened this issue Jul 7, 2022 · 15 comments
Labels
node.js Compatibility with Node.js APIs

Comments

@mikecann
Copy link

mikecann commented Jul 7, 2022

Aww I was really hoping this would work and thus get some TSC speed improvements.

But alas no luck.

image

Just so this is googleable, the error I get is:

 TypeError: undefined is not an object (evaluating 'process.stdout.isTTY')
      at /mnt/c/dev/gangbusters/battletabs/node_modules/typescript/lib/tsc.js:4274:27
      at defaultIsPretty (/mnt/c/dev/gangbusters/battletabs/node_modules/typescript/lib/tsc.js:104004:41)
      at updateReportDiagnostic (/mnt/c/dev/gangbusters/battletabs/node_modules/typescript/lib/tsc.js:103999:15)
      at executeCommandLineWorker (/mnt/c/dev/gangbusters/battletabs/node_modules/typescript/lib/tsc.js:104416:31)
      at /mnt/c/dev/gangbusters/battletabs/node_modules/typescript/lib/tsc.js:104765:0
      at bun:wrap:1:16354
      at bun:main:3:0

Im running bun 0.1.1 on WSL2

@Jarred-Sumner Jarred-Sumner added the node.js Compatibility with Node.js APIs label Jul 7, 2022
@Jarred-Sumner
Copy link
Collaborator

Jarred-Sumner commented Jul 7, 2022

Bun still needs to implement process.stderr, process.stdout, and process.stdin. It has Bun.stdout, Bun.stderr, and Bun.stdin, but that won't help for this particular case.

@mikecann
Copy link
Author

mikecann commented Jul 8, 2022

@Jarred-Sumner ah ye evan on Discord mentioned that too.

He also mentioned that you have already managed to get TSC working with Bun once.. Did you get much of a performance bump? It could be a gamechanger for many people if you get get a performance increase for TSC...

@gerardmarquinarubio
Copy link

I'm also interested in the performance gains bun could bring to TSC. Do you have any metrics on that @Jarred-Sumner?

@Neo1975
Copy link

Neo1975 commented Jul 11, 2022

same issue for me due to process.stderr.fd

TypeError: undefined is not an object (evaluating 'process.stderr.fd')
      at useColors (/Users/dfornaciari/Development/selly-email-sender/node_modules/debug/src/node.js:158:13)

@trevorsargent
Copy link

there's no workaround for this is there? I have the same issue as @Neo1975

@hanayashiki
Copy link

😄

@Electroid
Copy link
Contributor

We're making progress on the Node.js compatibility work that is required to get tsc to run. We'll update when we can get a minimal version running.

@github-actions github-actions bot removed the ecosystem label Nov 2, 2022
@mikecann
Copy link
Author

mikecann commented Nov 2, 2022

Awesome, if you can show a meaningful improvement in TSC performance with Bun I think that would be a big game changer for tooling for many folks.

@hanayashiki
Copy link

Awesome, if you can show a meaningful improvement in TSC performance with Bun I think that would be a big game changer for tooling for many folks.

I don't think jsc will be any faster than v8

@Electroid
Copy link
Contributor

This has been fixed since 0.3.0.

@Thalys
Copy link

Thalys commented Mar 28, 2023

I just tested this on a huge project with tons on files and a lot of template union types, and where node fails to compile with default memory settings, bun finished successfully 🫰

@hanayashiki
Copy link

hanayashiki commented Mar 30, 2023

I just tested this on a huge project with tons on files and a lot of template union types, and where node fails to compile with default memory settings, bun finished successfully 🫰

I tried running bun tsc rather than node tsc, on a 2000-3000 line project, but it turns out bun isn't running any faster than node 18. (Macos, intel)
1D9Ku65KVW

@DreierF
Copy link
Contributor

DreierF commented Mar 30, 2023

Also tried it on our Typescript project with approx 170k LoC and it was 10sec slower with bun. Node 18: 31sec, bun 0.5.8 41sec

@Thalys
Copy link

Thalys commented Mar 30, 2023

So our project has 189k LoC, and I don't know if it would be faster, normal tsc running on with node doesn't finish the compilation because of poor memory handling
Bun can finish, but not by running bun tsc. I think that still runs the binary with nodejs, but by running bun run node_modules/typescript/lib/tsc.js --noEmit --pretty that does the job because of better memory handling
With node I always hit the 4GB memory limit set crashing the process
(but it's not a replacement, using --watch crashes)

-edit-
I'm running on:

  Bun 0.5.8
  System: Linux Kernel: 5.15.102-1-MANJARO arch: x86_64 bits: 64 v: 5.26.5
  RAM: 32GB [(2x)type: DDR4 size: 16 GiB speed: 3600 MT/s]
  CPU: AMD Ryzen 9 5950X L1: 1 MiB L2: 8 MiB L3: 64 MiB
  Drives: SSD 980 PRO 2TB size: 1.82 TiB

@mctrafik
Copy link

Not a lot of things come up when searching bun tsc. For what it's worth I also noticed that our tsc takes ~49s, and bun tsc takes ~52s, for total savings of -3 seconds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
node.js Compatibility with Node.js APIs
Projects
None yet
Development

No branches or pull requests

10 participants