-
-
Notifications
You must be signed in to change notification settings - Fork 764
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
Doesn't support static/SSG outputs #586
Comments
Did you try? |
Did you try putting the decorator on just the pages you want? |
Oh I don't know I can do that. |
I doubt this will work.
|
Related to #544. Could investigate moving this to a static or similar. |
For reference: https://github.com/vinissimus/next-translate allows static pages, although, there seems to be a pre-build step creating pages from a separate Maybe the recently introduced |
I don't actually know if it's possible to support automatic static optimization with this library. I don't believe Maybe it's possible to move all the logic from |
@ckeeney I meant to use And yes, for the latter a middleware on the server is probably better than a HOC, or whatever comes out of the approach the nextjs team is taking with customized routes currently, although this still is a bit blurry for me. Agreed, next-i18next currently is not suitable for that / not sure how much of its current functionality could be kept for that. |
Currently, it is not. It will be possible with the upcoming NextJs plugin setup, assuming we also get middlewares support on view routes. Something like
No, it does not. The middleware is absolutely crucial for server side language detection, amongst other things. Basically: this package will be rewritten once plugin support drops, and should at that point in time support static and serverless deployments. We can't really clarify anything until the plugin API solidifies. |
@isaachinman do you think that NextJS 9.3 can help? |
@Pierre-CLIND We could indeed most likely migrate from |
The warning is (most probably) not responsible of this error. Check your logs server-side. |
I have the same warning, it's caused by the HoC Here is the next.js documentation about it: |
@AndyOGo that happens because we use in _app getInitialProps
Any news to avoid use getInitialProps in _app? |
There is no way around it for now. A lot of Next.js plugins rely on extending IMHO, static optimization is a small loss compared to the benefits |
Now that the custom server problem is sorted, will the potential switch to |
getInitialProps
in pages/_app
@Geoff-Ford Being able to support static/SSG output is an entirely different proposition. The If you were willing to completely drop cookie/redirect functionality, it would be possible to support static/SSG outputs. This is something I've been exploring recently, but do not have any concrete updates on. |
Thanks for that. Yes, this is what I was also thinking. Being able to statically generate pages with |
Yeah that's loosely correct, @Geoff-Ford. I have been kicking around ideas of how to support this, and it's on my list (after a few other more pressing matters). If you'd like to help, and/or discuss implementation, feel free to email me directly. |
Not necessarily. You can statically generate your sites and fetch data at build-time and/or return |
Excuse my ignorance, but I'm not quite following you here. Would you mind elaborating on why a server component is needed?
|
@nfantone Sure:
Server side language detection and redirection are the main sticking points that keep this project from supporting SSG. |
@isaachinman Thanks for the clarification above. If I may, let me rehash some of my previous comments based on yours.
Mind sharing the source of that? What's that proportion exactly? Incidentally, nginx/CDN/AWS/etc. solutions also "just work".
Which setups are you referring to here, exactly? I might be the odd one out, but most of the setups I enjoy working on and developing would happily accept client-redirects, as a trade-off, if it'd bring benefits to the table. |
Hi @nfantone. Checking cookies and performing redirects are definitely both features required by the majority of users. Some exciting stuff is coming from the Vercel team via the Next core directly, which may end up making this package unnecessary, and will still support cookies, redirects, and SSG. |
@isaachinman When? when will be these changes? |
@SalahAdDin Everything is here: |
The timeline is entirely dictated by the Vercel team. Please read through the RFC for the latest updates. |
A good chunk of i18n work has just been released!!: https://github.com/vercel/next.js/releases/tag/v10.0.0 |
Oh s***, here we go again. |
Nah, this was just an update for anyone following this now old thread that the core library have indeed released i18n built in, albeit just the beginnings. |
Please follow #869 for updates! |
Fixed in |
I get this error after building: You have opted-out of Automatic Static Optimization due to getInitialProps in pages/_app.
My _app.js file:
I know appWithTranslation HOC contains getInitialProps so that warning appears. Is there anyway to use it on each page individually but not the
pages/_app.js
?Thanks.
The text was updated successfully, but these errors were encountered: