withastro / astro

The web framework for content-driven websites. ⭐️ Star to support our work!
https://astro.build
Other
43.87k stars 2.29k forks source link

Prerender page conflicts are silently ignored #9832

Open Fryuni opened 5 months ago

Fryuni commented 5 months ago

Astro Info

> astro "info"

Astro                    v4.2.4
Node                     v18.18.0
System                   Linux (x64)
Package Manager          pnpm
Output                   static
Adapter                  none
Integrations             none

Describe the Bug

When two dynamic routes return parameters on getStaticPaths that result in the same URL the route with the lower priority according to the Routing Priority Order is silently ignored during build.

On the linked example:

Those two routes get sorted with /[bar].astro before /[foo].astro due to the alphabetical ordering rule. So /[bar].astro generates its 3 routes and then /[foo].astro generates just two of its routes with no other information provided to the developer:

> astro build

.... STUFF

 generating static routes 
21:30:54 ▶ src/pages/index.astro
21:30:54   └─ /index.html (+30ms)
21:30:54 ▶ src/pages/[bar].astro
21:30:54   ├─ /c/index.html (+2ms)
21:30:54   ├─ /d/index.html (+2ms)
21:30:54   └─ /e/index.html (+2ms)
21:30:54 ▶ src/pages/[foo].astro
21:30:54   ├─ /a/index.html (+2ms)
21:30:54   └─ /b/index.html (+1ms)
21:30:54 ✓ Completed in 84ms.

21:30:54 [build] 6 page(s) built in 1.40s
21:30:54 [build] Complete!

What's the expected result?

Ideally that should give at least a warning during the build.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-63iasx

Participation

cdtut commented 5 months ago

Please make it error not warning and fail the build or add option to make it error. If it happens it mean something is completely wrong and you can deploy unexpected thing.

Should also happen when it interferes with page that has no param like /c.astro.