apal21 / nextjs-progressbar

A simple Next.js progressbar component using NProgress.
https://www.npmjs.com/package/nextjs-progressbar
MIT License
780 stars 61 forks source link

progress bar would not appear in DOM when i18n domains is set. #41

Closed aboveyunhai closed 3 years ago

aboveyunhai commented 3 years ago

https://nextjs.org/docs/advanced-features/i18n-routing#getting-started

when i18n config includes domains

    domains: [
      {
        domain: 'example.com',
        defaultLocale: 'en-US',
        http: true,
      },
      {
        domain: 'fr.example.com',
        defaultLocale: 'fr',
        // an optional http field can also be used to test
        // locale domains locally with http instead of https
        http: true,
      },
    ],

The progress bar will not longer appear in DOM, but it works regularly without it.

I just take a look at the source code, I am not sure if it's an i18n router issue from next.js. But I want to make sure it's reproducible.

aboveyunhai commented 3 years ago

After further investigation it seems like the problem is that domians contains the original web domain, delete it solves the problem.

      {
        domain: 'example.com',
        defaultLocale: 'en-US',
        http: true,
      },
apal21 commented 3 years ago

Could you please share the repo where you can reproduce this?

aboveyunhai commented 3 years ago

Could you please share the repo where you can reproduce this?

I was unable to reproduce the problem in codesandbox due to the domain restriction, But the code itself is pretty simple, do you might just run it in your local machine with localhost?

https://codesandbox.io/s/vigorous-ritchie-n7o25?file=/next-i18next.config.js

apal21 commented 3 years ago

I've also seen a lot of features in Nextjs that won't work in development mode but works perfectly fine after creating the production build. As of now, I don't think anything can be done on the package level.

If you find something, please reopen the issue or submit a PR. I'm closing this for now.