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

Server locale detector does not work with .yml translation #2835

Closed
Applelo opened this issue Mar 12, 2024 · 4 comments · Fixed by #2878
Closed

Server locale detector does not work with .yml translation #2835

Applelo opened this issue Mar 12, 2024 · 4 comments · Fixed by #2878

Comments

@Applelo
Copy link

Applelo commented Mar 12, 2024

Environment

  • Operating System: Darwin
  • Node Version: v20.11.1
  • Nuxt Version: 3.10.3
  • CLI Version: 3.10.1
  • Nitro Version: 2.9.3
  • Package Manager: [email protected]
  • Builder: -
  • User Config: modules, security, htmlValidator, css, imports, multiCache, graphqlMiddleware, runtimeConfig, i18n, piniaPersistedstate, experimental, image, prismic, vite
  • Runtime Modules: @nuxtjs/[email protected]
  • Build Modules: -

Reproduction

YML (not working): https://stackblitz.com/edit/nuxt-i18n-localedector-yml?file=nuxt.config.ts
JSON (working): https://stackblitz.com/edit/nuxt-i18n-localedector-yml-nuxna8?file=nuxt.config.ts

Describe the bug

When we are using the experimental localeDetector option with .yml file translation and they are a problem with the compilation. There is no problem when we are using json file.

Additional context

No response

Logs

ERROR  [worker reload] [worker init] _import_meta_url_ is not defined                 
  at .nuxt/dev/index.mjs:1:65
  at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
  at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
  at async loadESM (node:internal/process/esm_loader:28:7)
  at async handleMainPromise (node:internal/modules/run_main:113:12)
@BobbieGoede
Copy link
Collaborator

I'm getting the same error in the playground after updating nitropack to 2.9.0 or higher, maybe related nuxt/nuxt#26170.

I haven't checked further (yet) if this is related to .yml files as you described.

@Applelo
Copy link
Author

Applelo commented Mar 14, 2024

I have added the a new reproduction (forked from the previous one) and change all .yml file into .json and it is working.

@BobbieGoede
Copy link
Collaborator

Now that unjs/nitro#2275 has been merged this issue can be resolved by overriding nitropack to install its nightly release (you will have to remove lockfiles before reinstalling). I have updated you reproduction to demonstrate here.

Not sure when then next nitro release will be, let's hope it's soon and that Nuxt includes it in the next release!

Let's keep this issue open until that's released, until then if anyone else runs into this add this to your package.json as a temporary workaround:

  "overrides": {
    "nitropack": "npm:nitropack-nightly"
  }

@Applelo
Copy link
Author

Applelo commented Mar 22, 2024

Thanks for the quick resolution 🔥

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants