Skip to content

fix(unplugin-vue-i18n): preserve vite:json ObjectHook shape for Vite 8 compatibility#554

Merged
kazupon merged 4 commits intov11from
fix/553
Apr 20, 2026
Merged

fix(unplugin-vue-i18n): preserve vite:json ObjectHook shape for Vite 8 compatibility#554
kazupon merged 4 commits intov11from
fix/553

Conversation

@kazupon
Copy link
Copy Markdown
Member

@kazupon kazupon commented Apr 18, 2026

Description

Linked Issues

resolve #553

Additional context

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 18, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7d2f43a2-9279-4e2d-82f8-44fa4160184c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/553

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@kazupon kazupon added the bug Includes new features label Apr 18, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 18, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@intlify/bundle-utils@554
npm i https://pkg.pr.new/@intlify/unplugin-vue-i18n@554

commit: 0064e1f

@kazupon
Copy link
Copy Markdown
Member Author

kazupon commented Apr 18, 2026

@mendrinos @ysya @floki1250 @benlavalley
I've just fixed this issue.

Could you try to check whether fixed this issue ?
You can override with pkg-pr-new packages.

@ysya
Copy link
Copy Markdown

ysya commented Apr 18, 2026

@kazupon Tested via the pkg.pr.new override — still fails with [vite:json] Failed to parse JSON file.

The ObjectHook fix is correct for #553, but in our setup it never runs: the isRolldownVite check uses import('vite'), which in mixed-vite setups may resolve to a different copy than the actual builder. Confirmed via DEBUG=unplugin-vue-i18n*Using rolldown-vite for the build (real builder is vite@7.3.1).

Trigger: any Nuxt 4 + Unocss project — @nuxt/vite-builder@4.4.2 depends on vite ^7.3.1, @unocss/vite@66.6.8 depends on vite ^8.0.7, so pnpm installs both.

Inspecting getVitePlugin(config, 'vite:json') directly would be resilient. Open as a separate issue?

@kazupon
Copy link
Copy Markdown
Member Author

kazupon commented Apr 19, 2026

@ysya
Thanks for feedback!
I've just re-fixed it!
Please try to check it again!

@ysya
Copy link
Copy Markdown

ysya commented Apr 19, 2026

@kazupon Confirmed fixed on 4c3c2b3, tested via pkg.pr.new override against the same mixed-vite setup (Nuxt 4.4.2 + @nuxt/vite-builder [vite ^7] + @unocss/vite [vite ^8], real builder is vite@8.0.8). Locale files now serve as unplugin-vue-i18n's pre-compiled module; Failed to load messages warning gone across all routes in a real Chrome session.

getFilter() still uses (await getViteModule()).rolldownVersion and prints Using filter for rolldown-vite in this setup even though the builder is plain vite@8. Not breaking for me (filter still matches locale files), but same class of issue as what you just fixed. Your call whether to address here or in a follow-up.

@kazupon
Copy link
Copy Markdown
Member Author

kazupon commented Apr 20, 2026

@ysya
Thank you for your advice, for my miss-take.
I've updated this PR.

For guys, if you have a time, please try to check this PR🙏

@kazupon kazupon merged commit 09863d2 into v11 Apr 20, 2026
19 checks passed
@kazupon kazupon deleted the fix/553 branch April 20, 2026 23:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Includes new features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants