fix: Build fails with Lingui/Vite error when using yarn instead of npm#4571
fix: Build fails with Lingui/Vite error when using yarn instead of npm#4571harshit078 wants to merge 16 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
All contributors have signed the CLA ✍️ ✅ |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe change modifies the Lingui Babel plugin in the Vite configuration to resolve Babel preset and plugin module paths at initialization time rather than relying on string specifiers during transformation. Using Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
I have read the CLA Document and I hereby sign the CLA |
grolmus
left a comment
There was a problem hiding this comment.
Several issues with this PR:
- Duplicate import —
import { createRequire } from 'node:module'appears twice (lines 1 and 3) - Duplicate
createRequirecall — both_requireand existingrequireare created fromcreateRequire(import.meta.url), only one is needed - Duplicate presets — the babel config now has BOTH the new resolved presets AND the old
require.resolve()ones:presetTypescript+require.resolve('@babel/preset-typescript')→ typescript preset runs twicepresetReactappears twice in the new code
- Incomplete —
@lingui/babel-plugin-lingui-macrois still using the oldrequire.resolve()approach
The intent is correct (resolve absolute paths for yarn PnP compatibility), but the implementation needs cleanup: remove the duplicate import, remove the duplicate _require/require, replace the old preset entries instead of adding alongside them, and also resolve the lingui plugin.
|
Hi @harshit078 |
|
Hey @michaelbromley , sure I'll give a brief detailed answer. Original issue
Why Npm solved it but not yarn
Fix
Why this works for both npm and yarn
|
|
Hey @grolmus , I have pushed a fix for comments you mentioned. Can you please take a look again ? Thanks ! |
Description
Breaking changes
No
Screenshots
You can add screenshots here if applicable.
Checklist
📌 Always:
👍 Most of the time: