molefrog / wouter

🥢 A minimalist-friendly ~2.1KB routing for React and Preact
https://npm.im/wouter
The Unlicense
6.41k stars 146 forks source link

Path component with prefixes is not supported in v3 #462

Closed Gerhut closed 2 weeks ago

Gerhut commented 3 weeks ago

Hi.

I previously set up a few of routes with prefixes, like

<Route path="/:project" component={ProjectPage} />
<Route path="/@:user" component={UserPage} />
<Route path="/~:org" component={OrgPage} />

After upgrading to v3, all of them are routed to the project page.

Any plan to fix this regression?

molefrog commented 2 weeks ago

In v3, we migrated to regexparam in favour of our custom parser which was difficult to maintain. This was a breaking change, so some things stopped working, however you can still support this route prefixes by opting in to path-to-regexp (it adds some extra KBs). You can use this guide to integrate path-to-regexp.