question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

i18n subroutes and rewrites not working in dev

See original GitHub issue

Bug report

Describe the bug

When combining new i18n subroutes and rewrites in development mode the rewrite-paths does not work.

To Reproduce

(Now do the same after npm run build && npm run start to see that the page(s) exist as expected)

To lazy to clone? boils down to this config:

module.exports = {
  i18n: {
    locales: ['en', 'sv'],
    defaultLocale: 'sv',
  },
  async redirects() {
    return [
      {
        source: `/_next/data/:deployment/hej.json`,
        destination: `/_next/data/:deployment/sv/hello.json`,
        permanent: true,
      }

    ];
  },
  async rewrites() {
    return [
      {
        source: '/hej',
        destination: '/sv/hello',
      }
    ];
  },
};

Expected behavior

The page named /hello should be shown for sv locale.

System information

  • OS: macOS
  • Browser (if applies) chrome
  • Version of Next.js: 10.0.0
  • Version of Node.js: v12.19.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
ijjkcommented, Dec 29, 2020

Hi, the rewrites + i18n support has been updated in the latest version of Next.js v10.0.5-canary.3 with updated documentation available here https://nextjs.org/docs/api-reference/next.config.js/rewrites#rewrites-with-i18n-support

I’m going to close this since similar issues related to this have been resolved, if anyone is still encountering issues with this please provide an updated minimal reproduction and we can investigate further!

1reaction
JohnLindahlTechcommented, Oct 30, 2020

Sadly it did not help. (Updated example repo for “proof”).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Next js rewrites not working for i18n routes - Stack Overflow
I'm having some issues with i18n rewrites in next js. Inside of my next.config.js I have the following /** @type {import('next').
Read more >
Advanced Features: Internationalized Routing - Next.js
js has built-in support for internationalized (i18n) routing since v10.0.0 . You can provide a list of locales, the default locale, and domain-specific...
Read more >
Create a nested navigation flow - Flutter documentation
Prepare for navigation; Display an app bar for the setup flow; Generate nested routes; Interactive example. Apps accumulate dozens and then hundreds of ......
Read more >
IIS URL Rewriting and ASP.NET Routing - Microsoft Learn
When a Web client requests a URL that does not conform to the format that you want, the client is redirected to a...
Read more >
The complete guide to internationalization in Next.js
In the past, creating multilingual applications was not an easy task, ... cuts through the noise to proactively resolve issues in your app ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found