nuxt / nuxt

The Intuitive Vue Framework.
https://nuxt.com
MIT License
53.01k stars 4.87k forks source link

fix: server handlers with `.json` suffix do not work anymore with nitro 2.9.2 #26168

Closed dargmuesli closed 3 months ago

dargmuesli commented 3 months ago

Environment

Reproduction

https://stackblitz.com/edit/github-eocpga?file=nuxt.config.ts,package.json

Describe the bug

Nitro PR https://github.com/unjs/nitro/issues/2217 seems to have introduced a breaking change for server handlers with .json.ts suffix.

Additional context

Nuxt OG image uses those routes for example: https://github.com/nuxt-modules/og-image/issues/172 Which makes automatic dependency updates like this go nana: https://github.com/dargmuesli/creal/pull/442

Logs

The error states

Error: Could not load raw:/home/projects/github-eocpga/bug/routes/index.json (imported by virtual:#internal/nitro/virtual/server-handlers): ENOENT: no such file or directory, open '/home/projects/github-eocpga/bug/routes/index.json

stackblitz[bot] commented 3 months ago

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

pi0 commented 3 months ago

Should be fixed in latest nitro release (https://github.com/unjs/nitro/pull/2239)