Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lazy load not runs #2171

Closed
agracia-foticos opened this issue Jun 20, 2023 · 9 comments
Closed

lazy load not runs #2171

agracia-foticos opened this issue Jun 20, 2023 · 9 comments
Assignees
Labels
lazy-loading ❗ p4-important Priority 4: bugs that violate documented behavior, or significantly impact perf v8

Comments

@agracia-foticos
Copy link

Environment

  • Operating System: Linux
  • Node Version: v18.16.0
  • Nuxt Version: 3.5.3
  • Nitro Version: 2.4.1
  • Package Manager: npm@9.5.1
  • Builder: vite
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Reproduction

Our nuxt.config.ts config:
i18n : { defaultLocale : process.env.NUXT_PUBLIC_LANG, locales: [ {code : 'cs', file: 'cs.json'}, {code : 'da', file: 'da.json'}, {code : 'de', file: 'de.json'}, {code : 'en', file: 'en.json'}, {code : 'es', file: 'es.json'}, {code : 'fr', file: 'fr.json'}, {code : 'it', file: 'it.json'}, {code : 'nl', file: 'nl.json'}, {code : 'pl', file: 'pl.json'}, {code : 'pt', file: 'pt.json'} ], langDir : 'locales/', lazy : true },

our lang filesystem

image

All lang files are loaded :(
image

Describe the bug

Our nuxt.config.ts config:
i18n : { defaultLocale : process.env.NUXT_PUBLIC_LANG, locales: [ {code : 'cs', file: 'cs.json'}, {code : 'da', file: 'da.json'}, {code : 'de', file: 'de.json'}, {code : 'en', file: 'en.json'}, {code : 'es', file: 'es.json'}, {code : 'fr', file: 'fr.json'}, {code : 'it', file: 'it.json'}, {code : 'nl', file: 'nl.json'}, {code : 'pl', file: 'pl.json'}, {code : 'pt', file: 'pt.json'} ], langDir : 'locales/', lazy : true },

our lang filesystem

image

All lang files are loaded :(
image

Additional context

No response

Logs

No response

@agracia-foticos
Copy link
Author

for more information We are using srcDir : 'src/',

@agracia-foticos
Copy link
Author

still waiting

Copy link
Collaborator

kazupon commented Jun 24, 2023

Thank you for your reporting!

However, We could not reproduce this issue...
We need an environment that anyone else can reproduce.

nuxt i18n issue guideline says:

The reporting guideline of nuxt-modules/i18n is compliant with Nuxt too.
Please carefully read the contribution docs before creating a bug report.
👉 https://nuxt.com/docs/community/reporting-bugs
Please use a template below to create a minimal reproduction, and provide to us your issue cases
👉 https://stackblitz.com/github/nuxt/starter/tree/v3-stackblitz
👉 https://codesandbox.io/p/github/nuxt/starter/v3-codesandbox

https://github.com/nuxt-modules/i18n/issues/new?assignees=&labels=pending+triage&projects=&template=bug-report.yml

Could you give us your minimal reproduction env please?

@agracia-foticos
Copy link
Author

https://stackblitz.com/edit/nuxt-starter-xqe68x

When i run this code with npm run dev, dont appear en.json in network tab in dev tools.

But if i compile with npm run build and node start, en.json appear in network tab in dev tools (lazy load not runs)

Copy link
Collaborator

kazupon commented Jul 3, 2023

related issue #2192

@agracia-foticos
Copy link
Author

any solution?

@agracia-foticos
Copy link
Author

with beta 13 dont runts :(

Copy link
Collaborator

kazupon commented Jul 10, 2023

I noticed that lazy loading is not working caused by #2192.
I will revert that PR as it is causing regression. /cc @userquin

@kazupon kazupon added lazy-loading ❗ p4-important Priority 4: bugs that violate documented behavior, or significantly impact perf and removed need reproduction 💻 labels Jul 10, 2023 — with Volta.net
@kazupon kazupon self-assigned this Jul 14, 2023
Copy link
Collaborator

kazupon commented Jul 16, 2023

Sorry for the late reply.
I have already fixed this issue.
You can try with the edge channel version (i18n-edge@8.0.0-beta.13-28155649.2e108fa)

BTW, your reproduction has the detectBrowserLanguage option enabled, so it tries to get the language from the browser or a cookie.
So depending on your environment, the nuxt i18n module to get that locale will also try that locale along with the default locale during initial loading.

Thanks!

@kazupon kazupon closed this as completed Jul 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lazy-loading ❗ p4-important Priority 4: bugs that violate documented behavior, or significantly impact perf v8
Projects
None yet
Development

No branches or pull requests

2 participants