Convenience injection of rewrites & exportPathMap #1156
Replies: 4 comments 5 replies
-
Hey @adam-rocska, thanks for the feature request! Yep, localized pathnames are known to not work with Next.js' static export since they rely on middleware. I've honestly not heard of That said, I guess this could be solved in userland while the feature is available, right? You mentioned that you already have a rough implementation working, mind sharing it in case it could be helpful for others? I'm wondering if in case Next.js removes this feature, this could be implemented via a postbuild script that moves files around appropriately to respect localized pathnames. |
Beta Was this translation helpful? Give feedback.
-
@amannn Thanks for the quick reply! Moving files around post-build makes me a bit edgy 😅 But sure, if this feature no longer will be around at some point, it might smell like it's the only option there. As of the workaround (deprecated) functions, sure, I'll generalize them later today & have it posted here on the thread. I wonder what the nextjs team might have in mind for this stuff. |
Beta Was this translation helpful? Give feedback.
-
Sounds great thanks! I'll move this to a discussion for now, as I think built-in support in |
Beta Was this translation helpful? Give feedback.
-
Well, I wasn't attentive enough and after coding the whole show today morning, it turns out this |
Beta Was this translation helpful? Give feedback.
-
Is your feature request related to a problem? Please describe.
When using
next-intl
with:output: "export"
basePath
(this might be a red herring)Both the built routing, and the
dev
served routing don't recognize the localized paths.Describe the solution you'd like
NextJS supports
exportPathMap
andrewrites
in its config.We could provide such utility functions which could automagically populate the routes according to rational dev expectations.
I'd sugest a wrapper / currying / composition instead of a simple utility function, since library users may already have
exportPathMap
s orrewrites
in place.If this sounds like a good idea, let me know in the comments and I'll open a PR.
I've got a rough implementation of this solution.
Describe alternatives you've considered
This combination of settings to the best of my knowledge can't be tackled in any other way 🫤
Beta Was this translation helpful? Give feedback.
All reactions