vercel / next.js

The React Framework
https://nextjs.org
MIT License
125.38k stars 26.78k forks source link

app\default is ignored after build #63830

Open anotherCoward opened 6 months ago

anotherCoward commented 6 months ago

Link to the code that reproduces this issue

https://codesandbox.io/p/devbox/sleepy-oskar-t6d39q

To Reproduce

  1. Create default.js in app\
  2. Run npm run dev
  3. Open localhost:3000/404
  4. Stop the running instance
  5. Run npm run build
  6. Run npm start
  7. Open localhost:3000/404

Current vs. Expected behavior

By following the file-naming convetion from https://nextjs.org/docs/app/building-your-application/routing#file-conventions and adding a default.js to the app directory it works fine when the server is running with npm run dev.

If I run npm run build and npm start the default is ignored on every 404 request and it injects this black default 404 error page.

I expect it to work in both instances the same as when I run npm run dev.

Provide environment information

Operating System:        
  Platform: win32
  Arch: x64
  Version: Windows 10 Pro
Binaries:
  Node: 18.17.0
  npm: N/A
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 14.1.0
  eslint-config-next: 14.1.0
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.4.2
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

App Router

Which stage(s) are affected? (Select all that apply)

next build (local), next start (local)

Additional context

Same problem occurs with next: 14.2.0-canary.47

devjiwonchoi commented 6 months ago

Hi, seems like it's resolved by https://github.com/vercel/next.js/pull/62370, it is applied to the canary but not on the stable versions yet.

anotherCoward commented 6 months ago

Hi @devjiwonchoi, I've tried it with 14.2.0-canary.47 and the behavior is still the same. default at the same level as the layout is ignored after build there too.

devjiwonchoi commented 6 months ago

@anotherCoward Could you please confirm canary 52?

anotherCoward commented 5 months ago

Same behavior on Next.js 14.2.0-canary.54. Still required to verify with canary 52?

default on the same level as layout is ignored after build. Only not-found/notFound() is displayed/executed.