next.js icon indicating copy to clipboard operation
next.js copied to clipboard

output: 'export' does not create _next/data folders but static site still looks for data json files when middleware.ts is present

Open pr1ntr opened this issue 5 months ago • 2 comments

Link to the code that reproduces this issue

https://github.com/pr1ntr/next-json-bug-repro

To Reproduce

npm run build
npx serve out/

Current vs. Expected behavior

current behavior is tries to fetch _next/data//about.json from the <Link href="about" />

Expected behavior is that it wont try to fetch _next/data//about.json

Provide environment information

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

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

Middleware / Edge (API routes, runtime), Static HTML Export (output: "export")

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

next build (local), Other (Deployed)

Additional context

I tested this in 14.0.4 and 14.1, another person tested canary with similar results.

pr1ntr avatar Jan 29 '24 18:01 pr1ntr

You may ask yourselves.. why do you have a middleware.ts file? Well because our prod/staging urls are in cloudfront/s3 but we still use vercel for previews.

pr1ntr avatar Jan 29 '24 18:01 pr1ntr