Example-app-router error when using output: 'export' (SSG) #1262
Replies: 2 comments
-
Are you by chance confusing Static Site Generation and There's no middleware that will run when you're using I'm going to move this to a discussion since this is a usage question and not a bug report. |
Beta Was this translation helpful? Give feedback.
-
When I use export default getRequestConfig(async () => {
// Provide a static locale, fetch a user setting,
// read locale from `cookies()`, `headers()`, etc.
// const locale = LOCALES.includes(navigator.language) ? navigator.language : "en";
// const locale = (await cookies()).get('locale')?.value || "en";
const locale = (await headers()).get('accept-language')?.split(",")[0] || "en";
return {
locale,
messages: (await import(`./messages/${locale}.json`)).default
};
}); I received these errors
Because I have enabled output "export" in Do you have any recommendations if I maintain the current next.config settings and utilize the app router without i18n routing? I would like the locale to be determined by the user's browser settings, either from request headers or navigator.language. Both methods are acceptable to me. |
Beta Was this translation helpful? Give feedback.
-
I am using example-app-router from next-intl github.
When I enter the URL without locale, for example, lcoalhost/pathname/, an error will occur.
Error: Page "/[locale]/page" is missing param "/pathnames" in "generateStaticParams()", which is required with "output : export" config.
When the URL is added with a locale like
/en/
, it will display normally. What should I do to make it display normally without adding the locale?If i dont use
ssg
, everything is fine.How do I make this all work? thanks
Beta Was this translation helpful? Give feedback.
All reactions