i18n icon indicating copy to clipboard operation
i18n copied to clipboard

differentDomains (true) conflict with Nuxt routeRules (ssr: false)

Open tungquach opened this issue 3 years ago • 5 comments

Environment

Nuxi 3.1.2



Reproduction

Add config routeRules to nuxt.config.ts:

routeRules: {
    '/auth/**': { ssr: false },
},

Config i18n module to have differentDomains = true in nuxt.config.ts:

modules: [
    [
      '@nuxtjs/i18n',
      {
        strategy: 'no_prefix',
        defaultLocale: 'en',
        fallbackLocale: 'en',
        langDir: './locales',
        differentDomains: true,
        locales: [
          { code: 'en', iso: 'en-US', file: 'en.yml', domain: 'http://localhost:8800' },
          { code: 'vi', iso: 'vi-VN', file: 'vi.yml', domain: 'http://localhost:8801' },
        ],
      }
    ]
],

Then go to any page that match routeRules like /auth/login to see it keep infinite refresh loop

Describe the bug

Browser refresh loop when going to route match routeRules (no SSR) with config differentDomains = true

Additional context

No response

Logs

No response

tungquach avatar Aug 04 '23 01:08 tungquach

Thank you for your reporting! I've backed from shot vacation.

Unfortunately, We could not your issue. Could you give your minimal reproduction us with stackbliz (nuxt starter) or github repo please? 🙏

kazupon avatar Aug 09 '23 10:08 kazupon

Thank you for your reporting! I've backed from shot vacation.

Unfortunately, We could not your issue. Could you give your minimal reproduction us with stackbliz (nuxt starter) or github repo please? 🙏

Here is it: https://stackblitz.com/edit/github-fjfcqz Go to "infinite loop refresh page" in the demo to see the problem

tungquach avatar Aug 10 '23 05:08 tungquach

Thank you for your reproduction!

I've faced the warning output in my env

 WARN  [@nuxtjs/i18n]: The differentDomains option and no_prefix strategy are not compatible. Change strategy or disable differentDomains option.

no_prefix strategy isn't supported with differentDomains: treu you need to change other strategy.

kazupon avatar Aug 10 '23 08:08 kazupon

Thank you for your reproduction!

I've faced the warning output in my env

 WARN  [@nuxtjs/i18n]: The differentDomains option and no_prefix strategy are not compatible. Change strategy or disable differentDomains option.

no_prefix strategy isn't supported with differentDomains: treu you need to change other strategy.

Thank you for clear that to me

tungquach avatar Aug 10 '23 14:08 tungquach

Hello @kazupon, We have the same issue, event if we use another strategy than 'no_prefix'. Here is a link to the stackblitz to reproduce : https://stackblitz.com/edit/nuxt-starter-iceuqr?file=nuxt.config.ts

karam12 avatar Aug 11 '23 13:08 karam12