remix-flat-routes
remix-flat-routes copied to clipboard
Make hybrid route character configurable
Thanks for creating this. I love this approach to v2 routing. I converted my application over to embrace it and unfortunately when I deployed on S3 my route files were 404/AccessDenied. I delved into this further and even though I can create a path in the bucket with the +
, S3 requires those assets to be requested with the +
URL encoded to %3D
. I asked in Remix Discord if there was a way to rewrite asset imports but there isn't. I had to resolve my problem using a terminal -
convention instead of the terminal +
and hard-coded -
into my clone of the repo. If this issue is of wider appeal and I'm not missing anything obvious, I can work a proper PR for configurability of this.
Interesting. So it's trying to access the build assets? Seems like something Remix or esbuild should handle then.
Anyway you're asking if I can add an option to configure the +
suffix? That should be easy. I already do that for the $
prefix.
Hi, I'm also having this issue, are there any updates for this pr? https://github.com/kiliman/remix-flat-routes/pull/70
Here's a temporary workaround:
{
routes: async defineRoutes => {
const routes = flatRoutes('routes', defineRoutes)
// remove + in route ids
const newRoutes = {}
Object.entries(routes).forEach(([routeId, route]) => {
route.id = routeId.replaceAll('+', '')
if (route.parentId) {
route.parentId = route.parentId.replaceAll('+', '')
}
newRoutes[route.id] = route
})
return newRoutes
},
}