summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Tony Sullivan <tony.f.sullivan@outlook.com> 2022-08-15 17:57:10 +0000
committerGravatar GitHub <noreply@github.com> 2022-08-15 13:57:10 -0400
commit0274b8d47be6ad2f5a503f70e2efdd52e43dc9c4 (patch)
tree8021b081da11540a9ccaca631213f01b8c39d868
parentfbf9752f17a4e55cadd552afb5b3728eb46f7d8d (diff)
downloadastro-0274b8d47be6ad2f5a503f70e2efdd52e43dc9c4.tar.gz
astro-0274b8d47be6ad2f5a503f70e2efdd52e43dc9c4.tar.zst
astro-0274b8d47be6ad2f5a503f70e2efdd52e43dc9c4.zip
SSR doesn't need to block multiple routes that match the same URL (#4329)
* fix: SSR doesn't need to block multiple routes that match the same URL * chore: add changeset
-rw-r--r--.changeset/orange-llamas-glow.md5
-rw-r--r--packages/astro/src/vite-plugin-astro-server/index.ts7
2 files changed, 5 insertions, 7 deletions
diff --git a/.changeset/orange-llamas-glow.md b/.changeset/orange-llamas-glow.md
new file mode 100644
index 000000000..21aeb0da8
--- /dev/null
+++ b/.changeset/orange-llamas-glow.md
@@ -0,0 +1,5 @@
+---
+'astro': patch
+---
+
+Updates routing logic to allow multiple routes to match the same URL in SSR
diff --git a/packages/astro/src/vite-plugin-astro-server/index.ts b/packages/astro/src/vite-plugin-astro-server/index.ts
index 7392ac33b..6cde51b4e 100644
--- a/packages/astro/src/vite-plugin-astro-server/index.ts
+++ b/packages/astro/src/vite-plugin-astro-server/index.ts
@@ -251,13 +251,6 @@ async function handleRequest(
async function matchRoute() {
const matches = matchAllRoutes(pathname, manifest);
- if (config.output === 'server' && matches.length > 1) {
- throw new Error(`Found multiple matching routes for "${pathname}"! When using \`output: 'server'\`, only one route in \`src/pages\` can match a given URL. Found:
-
-${matches.map(({ component }) => `- ${component}`).join('\n')}
-`);
- }
-
for await (const maybeRoute of matches) {
const filePath = new URL(`./${maybeRoute.component}`, config.root);
const preloadedComponent = await preload({ astroConfig: config, filePath, viteServer });