aralroca / next-translate-plugin

Next-translate plugin for i18n in Next.js 🌍 - Load page translations and use them in an easy way!
MIT License
32 stars 20 forks source link

Client-side routing requests incorrect path with `getServerSideProps` on Vercel #83

Open kodai3 opened 4 months ago

kodai3 commented 4 months ago

What version of this package are you using? ^2.6.2 What operating system, Node.js, and npm version? node: v20 What happened? When using client-side routing with getServerSideProps with the plugin enabled, the client-side requests are being sent to /example instead of the expected /_next/data/[build-id]/example.json. This results in every request hitting the server directly. Because I want to defer getServerSideProps on client side navigation regarding to this issue and workaround, this behavior slows down routings.

If you remove next-translate-plugin from next.config.js it works as expected with or without other plugins like next-pwa and @sentry/nextjs.

The reproduction is here. You can't see the problem when you yarn dev, yarn start or even vercel dev, but only deployed to Vercel. I haven't tested it with Cloud Run or similar services, so I don't know if they exhibit the same behavior other than Vercel.

What did you expect to happen? I expected the client-side routing to send requests to /_next/data/[build-id]/example.json

Are you willing to submit a pull request to fix this bug? I want, since it is affecting our production, but I will need some expertise as I am not very familiar.