Closed Git-I985 closed 1 month ago
@Git-I985 is attempting to deploy a commit to the next-intl Team on Vercel.
A member of the Team first needs to authorize it.
LGTM ))) @amannn
Hey @Git-I985, many thanks for your proposal to add a note to the docs to cover an error you've encountered!
The warning block is unfortunately very prominent and I haven't seen anybody run into this so far, I so I think I'd rather not include this.
Can you share though what you were trying to import that caused the error for you?
Closing due to inactivity …
@amannn
you know, I tried to import the redirects
section/field from next.config.js
to my sitemap, and im getting such errors
⨯ Error:
Could not locate i18n request config for next-intl.
These paths are supported by default:
- ./(src/)i18n/request.{js,jsx,ts,tsx}
- ./(src/)i18n.{js,jsx,ts,tsx}
Alternatively, you can specify a custom location in your Next.js config:
const withNextIntl = createNextIntlPlugin(
'./path/to/i18n/request.tsx'
);
at /usr/app/.next/server/chunks/9670.js:1:4177
at /usr/app/.next/server/chunks/9670.js:1:4515
at /usr/app/.next/server/chunks/9670.js:1:4641
at 12499 (/usr/app/.next/server/chunks/6852.js:1:2217)
at t (/usr/app/.next/server/webpack-runtime.js:1:143)
at 84936 (/usr/app/.next/server/chunks/6852.js:4:8681)
at t (/usr/app/.next/server/webpack-runtime.js:1:143)
at 70523 (/usr/app/.next/server/app/(service-pages)/(sitemaps)/proxy-sitemap-site.xml/route.js:1:1062)
at t (/usr/app/.next/server/webpack-runtime.js:1:143)
at t (/usr/app/.next/server/app/(service-pages)/(sitemaps)/proxy-sitemap-site.xml/route.js:1:1840)
My toughts about why it happen:
// next.config.js
const withNextIntl = createNextIntlPlugin();
// ...
const nextConfig = {
poweredByHeader: false,
compress: false,
output: 'standalone',
// ...
redirects: [...],
env: {},
}
module.exports = withNextIntl(nextConfig);
then i have such sitemap route
src/app/(service-pages)/(sitemaps)/proxy-sitemap-site.xml/route.ts
and im importing/using next.config.js
into it via
import nextConfig from '../../../../next.config';
// some stuff here ...
const redirects = (await (nextConfig as NextConfig).redirects?.()) ?? [];
FYI my sitemap is dynamic next page FYI im getting this error in build/production mode
so, and when im requesting sitemap page in my browser im getting error above, because of implementation of createNextIntlPlugin
Now i temp solved this with exporting all redirects stuff to another js module, redirects.config.js
, and im using this module where i need, in next.config.js
and sitemap
etc
And I tried to warn other people with my PR that they need to be careful with this imports from next.config.js
due to the implementation of createNextIntlPlugin
PS sorry for my language, im not native english speaker
Now i temp solved this with exporting all redirects stuff to another js module,
redirects.config.js
, and im using this module where i need, innext.config.js
andsitemap
etc
That's what I'd recommend too. Importing from next.config.js
into app code sounds like a source of bugs, beyond the issue with next-intl
you've encountered. Thanks for sharing your solution here!
The latest updates on your projects. Learn more about Vercel for Git ↗︎