oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
74.27k stars 2.77k forks source link

NextJS compilation time very slow #14359

Open coratgerl opened 1 month ago

coratgerl commented 1 month ago

What version of Bun is running?

1.1.29+6d43b3662

What platform is your computer?

Darwin 24.0.0 arm64 arm

What steps can reproduce the bug?

All my pages on NextJS take very long time to compile (with and without --bun).

[1] ✓ Compiled /dashboard in 7.5s (4697 modules)

What is the expected behavior?

It seems to be very slow, in Node it's like around 2s

What do you see instead?

No response

Additional information

No response

n2k3 commented 1 month ago

Can confirm with my local project on bun 1.0.30. bun --bun run dev ⚠ slow:

$ next dev --experimental-https
 ⚠ Self-signed certificates are currently an experimental feature, use with caution.
   Attempting to generate self signed certificate. This may prompt for your password
   CA Root certificate created in C:\Users\[redacted]\AppData\Local\mkcert
   Certificates created in E:\src\[redacted]\certificates
  ▲ Next.js 14.2.5
  - Local:        https://localhost:3000
  - Environments: .env.local, .env.development, .env
  - Experiments (use with caution):
    · swcPlugins

 ✓ Starting...
 ✓ Ready in 2.3s
 ○ Compiling / ...
 ✓ Compiled / in 18.8s (1408 modules)
 GET / 200 in 19591ms

bun run dev ✅ fast:

$ next dev --experimental-https
 ⚠ Self-signed certificates are currently an experimental feature, use with caution.
   Attempting to generate self signed certificate. This may prompt for your password
   CA Root certificate created in C:\Users\[redacted]\AppData\Local\mkcert
   Certificates created in E:\src\[redacted]\certificates
  ▲ Next.js 14.2.5
  - Local:        https://localhost:3000
  - Environments: .env.local, .env.development, .env
  - Experiments (use with caution):
    · swcPlugins

 ✓ Starting...
 ✓ Ready in 1180ms
 ○ Compiling / ...
 ✓ Compiled / in 1331ms (1385 modules)
(node:297568) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
(Use `node --trace-warnings ...` to show where the warning was created)
 GET / 200 in 1969ms

pnpm run dev 🟡 normal:

> next dev --experimental-https

 ⚠ Self-signed certificates are currently an experimental feature, use with caution.
   Attempting to generate self signed certificate. This may prompt for your password
   CA Root certificate created in C:\Users\[redacted]\AppData\Local\mkcert
   Certificates created in E:\src\[redacted]\certificates
  ▲ Next.js 14.2.5
  - Local:        https://localhost:3000
  - Environments: .env.local, .env.development, .env
  - Experiments (use with caution):
    · swcPlugins

 ✓ Starting...
 ✓ Ready in 1135ms
 ○ Compiling / ...
 ✓ Compiled / in 3.6s (1408 modules)
(node:296836) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
(Use `node --trace-warnings ...` to show where the warning was created)
 GET / 200 in 4086ms

possibly relevant info: bun: 1.1.30+7996d06b8 OS: Microsoft Windows NT 10.0.22631.0 x64 (Windows 11 Pro 23H2) CPU: AMD Ryzen 9 7950X3D 16-Core Processor with 64GB ram Code located on NVMe SSD formatted using ReFS (a DevDrive)