next-translate-routes icon indicating copy to clipboard operation
next-translate-routes copied to clipboard

NextJS trailingSlash not supported

Open christoph-pflueger opened this issue 3 years ago • 6 comments

NextJS has an option to configure trailing slashes in URLs: https://nextjs.org/docs/api-reference/next.config.js/trailing-slash

At the moment, this option causes mismatches between server and client.

christoph-pflueger avatar Nov 26 '21 19:11 christoph-pflueger

Hi @git-chrisp, I added the trailing slash option to the next.config.js in the repo example, and I don't experience any problem. Could you give more details, or better, a reproduction of the bug?

cvolant avatar Dec 07 '21 09:12 cvolant

Reproduction: https://github.com/git-chrisp/next-translate-routes-nextjs-trailing-slash-bug

When visiting localhost:3000/de/ the following error is printed in the console:

next-dev.js?3515:32 Warning: Prop `href` did not match. Server: "/de/seite1" Client: "/de/seite1/"

christoph-pflueger avatar Dec 20 '21 21:12 christoph-pflueger

At first, I could not reproduce: I don't know why, but I did not get the warning on Firefox. I tried on Chromium - just in case - and I got it. I added a fix in the next release.

cvolant avatar Dec 23 '21 12:12 cvolant

Done. Please reopen this if it is not fixed for you.

cvolant avatar Jan 05 '22 17:01 cvolant

@cvolant on next v13 I have the same problem.

artemkhalygov avatar Mar 14 '23 14:03 artemkhalygov

Hi, I also get this error too while having trailing slash option true in next.config.js next-translate-routes: 1.9.1v next: 12.3.4v

stovein avatar Mar 15 '23 20:03 stovein