-
-
Notifications
You must be signed in to change notification settings - Fork 206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
next-translate-plugin breaks SSG in app router #1154
Comments
@aralroca I found the same issue recently when I started to migrate pages from Right now I started to migrate pages with translations and this is definitely a bigger issue given that any page I migrate will be dynamic because of next-translate. Are we missing something with the next-translate configuration? Edit: I found the culprit, I tried to remove The usage of searchParams will make all the pages dynamic, I don't know what would be the alternative given that I'm not deep into the possible ramifications. |
@jakubjanousek @aralroca this is not a (final) solution but it displays where the problem is with the given repo,
|
good catch @hensansi, unfortunately I am not familiar with the reasons why searchParams is there for now, we have removed this allows us to have SSG by default while keeping all of the next-translate interface, but it is a very specific use case, since each of our languages is a single site that knows its locale at build time |
I'm having the same problem @jakubjanousek Can I share your |
@jakubjanousek Could you please share the code snippet or implementation details for this? It would be greatly helpful to understand how you integrated this into your setup. |
Our situation is a bit specific that we have several deployment, but each has only a single translation. Therefore we are able to copy only the necessary translation before starting the server into current a simplified version is something like this
|
@jakubjanousek Thank you so much for sharing your code and approach. In the end, we switched to using next-intl which solved our problems. |
What version of this package are you using?
2.6.0
What operating system, Node.js, and npm version?
node v20.4.0
What happened?
Once
next-translate-plugin
is used innext.config.js
, pages cannot be statically generated in app router. There is nothing dynamic on the page or layoutmodule.exports = nextTranslate();
results in┌ λ / 5.35 kB 85.8 kB
module.exports = {}
results in┌ ○ / 5.25 kB 85.6 kB
i18n.json is
Any ideas why this is happening? You can check a minimal example at https://github.com/jakubjanousek/next-translate-ssg-issue
What did you expect to happen?
Pages without getServerSideProps will be statically generated with
yarn build
Are you willing to submit a pull request to fix this bug?
The text was updated successfully, but these errors were encountered: