-
-
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
Custom Server and Static Optimization #120
Comments
First of all, a clarification: There is no static optimization using a custom server with Next.js. (with or without next-translate). Optimization means serverless functions, SSG and static pages. This is a Next.js requirement. Nevertheless, if you are using a custom server and you want to use
You can read the behavior of the middleware here: Basically is doing two things:
Maybe we can clarify this in the docs. We have these docs only for the custom server case: Feel free to do a PR fixing the parts that for you are not clear. |
Note: Probably in the future, we are going to unify the way to use this lib in just one way. |
Thanks for taking the time to answer Mr. Regarding the custom server issue, is indeed possible to keep Static Optimization (SO) enabled even if you're using a custom server. I've created this repository to demonstrate: https://github.com/italoayres/nextjs-with-redux-ssr BTW, I had already read the docs on using a custom server with I still don't fully understand the complexities of SSR with NextJs, so it is hard for me to evaluate if this is truly possible or no. But, as I can see, at least there's no inherited flaw on using a custom server that would completely prevent static optimization. |
Amazing @italoayres . I didn't know that with a Custom Server it can still maintain the Automatic Static Optimization. In the Next.js docs is saying the opposite: source: https://nextjs.org/docs/advanced-features/custom-server Nevertheless, using the The The |
I agree that the docs should be updated and clarify these things better. |
Hello Sirs,
Would you mind elaborating on this?
As I understand, is there no way to make static optimization work if I'm using next-translate with a custom server? How is using the custom server middleware different from using Next default server?
Would you please share any thoughts or updates on this matter?
Much obliged.
The text was updated successfully, but these errors were encountered: