Skip to content
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

Export with withNamespaces messing with SSR #52

Closed
yonjuukyuu opened this issue Dec 14, 2018 · 8 comments
Closed

Export with withNamespaces messing with SSR #52

yonjuukyuu opened this issue Dec 14, 2018 · 8 comments

Comments

@yonjuukyuu
Copy link

Hi there, i have setup i18next with SSR and is working fine for me on dev, but on production the pre-rendering of the page with fetch isomorphic-unfetch and getInitialProps is not working as expected.

everything is been rendered on client , and i wanted to render on server and deliver as html, which if i remove the export withNamespaces to the default export of nexus.js it works fine bu then translations won't work.

I am i doing something wrong the setup that i have is based on the exemples you have on the git _app.js , i18n.js , and nextI18NextMiddleware on server.js

@yonjuukyuu yonjuukyuu changed the title Export with withNamespaces messing with SEO ? Export with withNamespaces messing with SSR Dec 14, 2018
@Clebal
Copy link

Clebal commented Dec 14, 2018

I'm having an error also in production, but I think it's due to using next-redux-saga and next-redux-wrapper with next-i18next. I've made a CodeSanbox: https://codesandbox.io/s/v8796vz3m5. The error appears also using react-redux 6.0.0 (in the sandbox i'm using 5.1.1). Hope it helps. Thank you.

@isaachinman
Copy link
Contributor

Hi @yonjuukyuu and @Clebal.

@yonjuukyuu Do you mind explaining your problem a little bit more, or sharing a repository / CodeSandbox to reproduce the issue? I don't really understand what you are saying so far. Do you mean that you're doing next export?

which if i remove the export withNamespaces to the default export of nexus.js it works fine

What does this mean?

I'm not familiar with "isomorphic-unfetch" but I doubt that is affecting your next-i18next implementation.

Basically - as soon as you can show me code / a reproducible example, I can help you.

@isaachinman
Copy link
Contributor

@Clebal I am still getting a 502 on your CodeSandbox (don't know if they're down or what). But let's keep the discussion of your problem to the original issue, #52.

@jdaude
Copy link

jdaude commented Dec 14, 2018

Hello Isaac

I have the same issue without any dependency like he mentioned, just try to export with your example form this repo, export doesnt work anymore, there is what my terminal shows :

No "exportPathMap" found in "next.config.js". Generating map from "./pages"
exporting path: /404
exporting path: /about
TypeError: Cannot read property 'router' of undefined

I updated from v.0.8.0 to v0.10.2

Thanks

@isaachinman
Copy link
Contributor

just try to export with your example form this repo, export doesnt work anymore

What do you mean export? Do you mean running next export?

If someone provides clear steps to reproduce the problem, I can definitely debug this. However, I should be absolutely clear that doing a next export misses the entire point of this package and is not advised at all. You'll end up with a clientside-only app. If you want to export, I suggest simply creating your Next routes/pages manually for each language and not using next-i18next at all.

next-i18next is a SSR package.

@isaachinman
Copy link
Contributor

Any update here?

@yonjuukyuu
Copy link
Author

Any update here?

Will try to push it to a repo. today

@isaachinman
Copy link
Contributor

I can confirm that export should be fully functional with the new approach taken from v0.11.x onwards.

I want to reiterate that doing next export and then serving static HTML with next-i18next completely misses the point of this package - SSR.

That said, it's simple enough to support export, so if you do find an issue please let me know and I'll reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants