Skip to content

Commit

Permalink
fix(custom-routing): Enable global routing
Browse files Browse the repository at this point in the history
  • Loading branch information
Fryuni committed Jul 6, 2024
1 parent 890c74a commit 452585a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/gorgeous-papayas-wonder.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@inox-tools/custom-routing': patch
---

fix: Enable global routing priority so custom routing mix correctly with file-based routes
8 changes: 7 additions & 1 deletion packages/custom-routing/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,19 @@ function customRoutingInner({ strict, routes }: Options): AstroIntegration {
return {
name: '@inox-tools/custom-routing',
hooks: {
'astro:config:setup': ({ injectRoute }) => {
'astro:config:setup': ({ injectRoute, updateConfig }) => {
for (const [route, handle] of Object.entries(routes)) {
injectRoute({
entrypoint: handle,
pattern: route,
});
}

updateConfig({
experimental: {
globalRoutePriority: true,
},
});
},
...(strict && {
'astro:build:setup': ({ vite, pages }) => {
Expand Down

0 comments on commit 452585a

Please sign in to comment.