The output of Cloudflare Adaptor,dist/_routes.json, has a different configuration depending on the value of build.format in astro.config.mjs.
In particular, the exclude in build.format: "file" does not seem to be set correctly.
/pages/ssg/index.astro: prerender = true
/pages/ssg/[ssr]/index.astro: prerender = false
In build.format: "directory", /pages/ssg/index.astro takes precedence over /pages/ssg/[ssr]/index.astro.
However, with build.format: "file", /pages/ssg/[ssr]/index.astro takes precedence and a 404 is returned when trying to access /pages/ssg/index.astro.
This is because exclude does not include "/ssg/" and SSR with "/ssg/*" in include are preferred.
This is not surprising, since the SSR script does not have a corresponding process for /pages/ssg/index.astro, but the difference in behavior is annoying.
Astro Info
Describe the Bug
The output of Cloudflare Adaptor,
dist/_routes.json
, has a different configuration depending on the value of build.format inastro.config.mjs
.In particular, the
exclude
inbuild.format: "file"
does not seem to be set correctly./pages/ssg/index.astro
: prerender = true/pages/ssg/[ssr]/index.astro
: prerender = falseIn
build.format: "directory"
,/pages/ssg/index.astro
takes precedence over/pages/ssg/[ssr]/index.astro
.However, with
build.format: "file"
,/pages/ssg/[ssr]/index.astro
takes precedence and a 404 is returned when trying to access/pages/ssg/index.astro
.This is because
exclude
does not include "/ssg/" and SSR with "/ssg/*" ininclude
are preferred.This is not surprising, since the SSR script does not have a corresponding process for
/pages/ssg/index.astro
, but the difference in behavior is annoying.What's the expected result?
This is also true for
mode: "hybrid"
.dist/_route.json
outputsmode: "server", build.format: "file"
expected
actual
mode: "server", build.format: "file"
No problem.
Link to Minimal Reproducible Example
https://stackblitz.com/edit/withastro-astro-3jxjgu?file=dist%2F_routes.json
Participation