i18next/next-i18next

Next export is broken with v6.0.0

clement-faure opened this issue ยท 11 comments

Describe the bug

Trying to next export the application using latest version of next-i18next (v6.0.0)

Occurs in next-i18next version

"next-i18next": "^6.0.0"

Steps to reproduce

clement-faure/next-antd-graphql-starter@c2b8f0b

Git clone next-antd-graphql-starter and run next export

Screenshots

image

OS

  • Device: MBP 2019 16"

Next export is not something this package can easily support. If you want fully static websites, you're better off rolling dynamic directories on your own.

If you'd like to investigate and contribute though, you are more than welcome!

Thank you for the quick response @isaachinman !

No problem. Bit more context: next export apps represent a pretty small proportion of NextJs apps โ€“ most are hybrid apps. On top of that, certain data fetching methods (including getServerSideProps, etc) are incompatible with next export. There are no plans to support next export.

We managed to make it work (result was client side only app) in the past, but even that was not a very good idea โ€“ you may as well use CRA with react-i18next, or something.

I'll remove that line from the docs.

Ha @clement-faure great minds think alike.

@isaachinman You might want to take a look at this issue I've just opened vercel/next.js#15674

next export might be a minor usage in proportion, but not necessarily small usage at all. I hope that in the future getServerSideProps becomes available again with next export, by just being ignored.
Can you maybe reopen this issue to keep the discussion open?

@eric-burel I thought that Tim was quite clear about the incompatibility?

Do you have more reference o nthis ? Those feature are incompatible, but no need to drop the support of next export altogether, getServerSideProps can just be ignored during next export.

Supporting both is really a great value to us, and that for non trivial applications.
Note that I get that the solution is probably not at next-i18nnext level.

Fairly soon, next-i18next will support static/SSG outputs from next build. I don't have any plans to put effort into supporting next export, but if anyone wants to lead that effort, I can certainly reopen this issue and answer any questions they may have.

Technically if it works for next static build on your side, it should work with next export with no additional work, provided getServerSideProps is left compatible with next export. So yeah, the solution is most probably on Next side, will wait for their answer.
First step is to make my case in favour of supporting both next export and dynamic server side rendering in the same codebase ^^

provided getServerSideProps is left compatible with next export [...] next export and dynamic server side rendering in the same codebase

I don't foresee either of those things happening. But again, happy to reopen if someone else wants to lead the implementation.

No problem. Bit more context: next export apps represent a pretty small proportion of NextJs apps โ€“ most are hybrid apps. On top of that, certain data fetching methods (including getServerSideProps, etc) are incompatible with next export. There are no plans to support next export.

We managed to make it work (result was client side only app) in the past, but even that was not a very good idea โ€“ you may as well use CRA with react-i18next, or something.

I'll remove that line from the docs.

Can you explain what CRA in react-i18next is? Thanks!

Can you explain what CRA in react-i18next is? Thanks!

Basically he's saying just use create-react-app with any i18n package