This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
useTranslations in RSC breaks static export (...because it used headers()) #1672
Closed
3 tasks done
Labels
Description
Howdy. Love the library, using it with Next.js App Router. Got it working pretty well for a hybrid application setup to run both as RSC's and as static exports. Only one issue I'm running into...
I'm able to useTranslations just fine in server components, this is great for SSR. It works in npm run dev, it works in production on Vercel, very good.
However, once I do my static export, I get the following error:
Here is my page
Sadly I have to add "use client" everywhere I am using useTranslations, which is only required for static exports. I wish there was some way to bypass this, so I didn't have to duplicate tons of components into client versions, just to use translations on them, specifically for static export. Since the RSC's work just fine and do compile into static pages without useTranslations
Verifications
Mandatory reproduction URL
https://newtech.dev
Reproduction description
useTranslations in a server component with output: "export"
Expected behaviour
No error, translations just work regardless of static export when using useTranslations hook, skips the headers() check during static exports, or skips it altogether?
The text was updated successfully, but these errors were encountered: