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

fix(raw): exclude yaml from raw plugin #2275

Merged
merged 1 commit into from Mar 21, 2024

Conversation

BobbieGoede
Copy link
Contributor

@BobbieGoede BobbieGoede commented Mar 17, 2024

πŸ”— Linked issue

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Nuxt I18n is running into issues specifically with yaml files since nitro 2.9.2+, I think because we're trying to parse and transform the file ourselves but it's already been handled as a raw file?

Let me know if this is not the correct way to resolve this or if there is a way for us to exclude specific files from being handled, I'm following this PR #2239 as an example (it looks like it added checks for yaml as well anyway).

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@pi0
Copy link
Member

pi0 commented Mar 18, 2024

Would you please make a minimal reproduction with nitro that works before 2.9 and broken with 2.9.2? πŸ™πŸΌ (i understand it might be a bug. it needs reproduction to proceeded)

@BobbieGoede
Copy link
Contributor Author

BobbieGoede commented Mar 18, 2024

Sorry, I should have included a reproduction in the first place, I know how annoying it can be without (was a bit drained).

Here is the reproduction: https://github.com/BobbieGoede/nuxt-i18n-yaml-nitro-raw

Interesting to note, this issue only happens when using the server side translation feature, which adds a server/nitro plugin as well as plugins to transform yaml and json5 files (see relevant code), there are no issues using json5 files as seen in the reproduction.

Using nitro 2.9.1

  • Install and run using pnpm i && pnpm run dev
  • Open page and observe behaviour is as expected
  • (optional) Build project using pnpm run build
    • Observe transformed yaml locale file at .output/server/chunks/build/ja-[hash].mjs

Using nitro >=2.9.2

  • Remove pnpm.overrides from package.json and install and run again using pnpm i && pnpm run dev
  • Terminal will throw error [worker reload] [worker init] _import_meta_url_ is not defined, page stuck on Nuxt loading splash logging 503 status
  • (optional) Build project using pnpm run build
    • Observe transformed yaml locale file at .output/server/chunks/raw/ja.mjs

@brtinney
Copy link

Just adding on that this seems to be throwing an error in my projects as well. They use the rollup yaml plugin to process the yaml files into JS objects, but after nitro 2.9.2, there's an error on dev startup saying no such file or directory. There's probably a way for me to make sure the raw plugin doesn't take over that may resolve the issue, but I assume this PR will do that too.

@pi0 pi0 merged commit a072a76 into unjs:main Mar 21, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants