Open mkbctrl opened 9 months ago
+1. Having this issue as well.
I don't have experience with next-connect
, but if someone is interested in adapting the middleware accordingly and this doesn't have any negative side effects for the standalone usage (same API, no significant change in bundle size), I'd be happy to review a PR!
Is your feature request related to a problem? Please describe.
I prefer to organize my middlewares with next-connect, however after installing next-intl I run into the following issue:
My
redirectMiddleware
did not trigger. I tried several different combinations trying to build a custom wrapper around the i18nMiddleware that normally looks like this:here is one example of the attempt: https://github.com/hoangvvo/next-connect?tab=readme-ov-file#nextjs-middleware
but this was creating the following error:
It's my first time with
next-intl
so maybe I am missing smth obvious, but been bumping my head against this for few hours, and I can't figure it out, chat-gpt couldn't help as well 😅Describe the solution you'd like
router.use(i18nMiddleware, redirectMiddleware)
orrouter.use(i18nMiddleware).use(redirectMiddleware)
Describe alternatives you've considered
Currently I have this blob that works, but it's hard to look at it (that's why I want to decouple it with next-connect):