Skip to content

Conversation

pashaie
Copy link
Contributor

@pashaie pashaie commented Sep 29, 2025

Currently, in file based routing, the generated routes.ts file creates the routes object but doesn't export it, making it difficult to build dynamic navigation menus that need to iterate over available routes.

Current generated code:

const routes = {
  '/about': () => import('../src/routes/about.svelte'),
  '/': () => import('../src/routes/index.svelte')
};

Proposed change:

export const routes = {
  '/about': () => import('../src/routes/about.svelte'),
  '/': () => import('../src/routes/index.svelte')
};

This would be a non-breaking change that enables dynamic menu generation and other use cases where programmatic access to the route configuration is needed.

Copy link

changeset-bot bot commented Sep 29, 2025

🦋 Changeset detected

Latest commit: 7ba2655

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Sep 29, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
sv-router Ignored Ignored Preview Sep 30, 2025 8:17pm

@colinlienard
Copy link
Owner

Thanks for your pr @pashaie
There's just a failing test, it should be an easy fix

@pashaie
Copy link
Contributor Author

pashaie commented Sep 30, 2025

@colinlienard thanks for your hard works.
sorry, I just added export from github itself and didn't ran tests
it's passing now

Export the routes object to support dynamic menu generation.
Copy link
Owner

@colinlienard colinlienard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@colinlienard colinlienard merged commit 3388c30 into colinlienard:main Sep 30, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants