oven-sh / bun

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

Live reload does not work with next.js 13 app router when using a custom server #6726

Open GGAlanSmithee opened 11 months ago

GGAlanSmithee commented 11 months ago

What version of Bun is running?

1.0.7

What platform is your computer?

Windows 10, WSL 2 with Ubuntu-20.04

What steps can reproduce the bug?

  1. Create a new next.js project bunx create-next-app (y to all prompts) 1a. If on WSL, do not place the project under /mnt
  2. Add a custom server: https://nextjs.org/docs/pages/building-your-application/configuring/custom-server 2a. name it server.ts instead of server.js
  3. run bun --bun server.ts and open http://localhost:3000 in your browser
  4. make a change in app/page.tsx

What is the expected behavior?

the file is updated with live reload

What do you see instead?

nothing happens, until you refresh the browser

Additional information

This works as expected if

  1. you don't use a custom server
  2. use node.js, everything else being equal
oyal commented 2 days ago

I encountered the same problem. I resolved this problem using nodemon accrording to the official website.

https://github.com/vercel/next.js/tree/canary/examples/custom-server