Skip to content

fix(loader): make webpack peer dependency optional and update Rspack example#2475

Merged
andrii-bodnar merged 9 commits intolingui:nextfrom
yslpn:fix/loader-rspack-rsbuild-peers
Apr 15, 2026
Merged

fix(loader): make webpack peer dependency optional and update Rspack example#2475
andrii-bodnar merged 9 commits intolingui:nextfrom
yslpn:fix/loader-rspack-rsbuild-peers

Conversation

@yslpn
Copy link
Copy Markdown
Contributor

@yslpn yslpn commented Mar 13, 2026

Description

Extend @lingui/loader peer dependency metadata for Rspack and Rsbuild environments, and update the loader docs to describe Webpack-compatible usage more clearly.

UPD:

Made webpack optional peerDependencies and updated the rspack example

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Examples update

Fixes # (issue)

Checklist

  • I have read the CONTRIBUTING and CODE_OF_CONDUCT docs
  • I have added tests that prove my fix is effective or that my feature works
  • I have added the necessary documentation (if appropriate)

@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 13, 2026

@yslpn is attempting to deploy a commit to the Crowdin Team on Vercel.

A member of the Team first needs to authorize it.

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.01%. Comparing base (dd43fb0) to head (2d8ec9f).
⚠️ Report is 335 commits behind head on next.

Additional details and impacted files
@@             Coverage Diff             @@
##             next    #2475       +/-   ##
===========================================
+ Coverage   76.66%   89.01%   +12.35%     
===========================================
  Files          81      118       +37     
  Lines        2083     3315     +1232     
  Branches      532      978      +446     
===========================================
+ Hits         1597     2951     +1354     
+ Misses        375      329       -46     
+ Partials      111       35       -76     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@timofei-iatsenko
Copy link
Copy Markdown
Collaborator

@yslpn does it work without adding them into peer dependencies? I'm questioning what the reason of adding it explicitly? Usually we add something if we use (require or import) something from there, so package manager would build a correct graph.

But in this case it used only as a metadata to specify what version range of rsbuild/rspack is supported?

Maybe it would be just enough to update the docs?

@yslpn
Copy link
Copy Markdown
Contributor Author

yslpn commented Apr 2, 2026

@yslpn does it work without adding them into peer dependencies? I'm questioning what the reason of adding it explicitly? Usually we add something if we use (require or import) something from there, so package manager would build a correct graph.

But in this case it used only as a metadata to specify what version range of rsbuild/rspack is supported?

Maybe it would be just enough to update the docs?

It works but I'd like to remove warnings from package managers for projects that don't require webpack.

❯ yarn install
➤ YN0000: ┌ Resolution step
➤ YN0002: │ rspack-react-ts-starter@workspace:. doesn't provide webpack (p82fb2), requested by @lingui/loader
➤ YN0000: │ Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code
➤ YN0000: └ Completed
➤ YN0000: ┌ Fetch step
➤ YN0000: └ Completed
➤ YN0000: ┌ Link step
➤ YN0008: │ esbuild@npm:0.25.12 must be rebuilt because its dependency tree changed

@yslpn
Copy link
Copy Markdown
Contributor Author

yslpn commented Apr 3, 2026

Should I add "@lingui/loader" to the rspack example?

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
js-lingui Ready Ready Preview Apr 15, 2026 7:50am

Request Review

@andrii-bodnar andrii-bodnar added this to the v6 milestone Apr 6, 2026
@andrii-bodnar andrii-bodnar added the ↻ awaiting rebase Rebase is needed due to conflicts label Apr 6, 2026
@andrii-bodnar andrii-bodnar removed the ↻ awaiting rebase Rebase is needed due to conflicts label Apr 6, 2026
@timofei-iatsenko
Copy link
Copy Markdown
Collaborator

@yslpn does it work without adding them into peer dependencies? I'm questioning what the reason of adding it explicitly? Usually we add something if we use (require or import) something from there, so package manager would build a correct graph.
But in this case it used only as a metadata to specify what version range of rsbuild/rspack is supported?
Maybe it would be just enough to update the docs?

It works but I'd like to remove warnings from package managers for projects that don't require webpack.

❯ yarn install
➤ YN0000: ┌ Resolution step
➤ YN0002: │ rspack-react-ts-starter@workspace:. doesn't provide webpack (p82fb2), requested by @lingui/loader
➤ YN0000: │ Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code
➤ YN0000: └ Completed
➤ YN0000: ┌ Fetch step
➤ YN0000: └ Completed
➤ YN0000: ┌ Link step
➤ YN0008: │ esbuild@npm:0.25.12 must be rebuilt because its dependency tree changed

Got it, so basically it's more about seting a webpack as optional. Maybe then let's just do that? Set webpack as optional without adding rspack and friends as peer deps.

Should I add "@lingui/loader" to the rspack example?

Yes please.

@yslpn
Copy link
Copy Markdown
Contributor Author

yslpn commented Apr 13, 2026

Got it, so basically it's more about seting a webpack as optional. Maybe then let's just do that? Set webpack as optional without adding rspack and friends as peer deps.

I don't mind, but I want to understand. Are you concerned that specifying rspack/rsbuild will lead to new code additions and make maintenance more difficult?

On the other hand, I see benefits in defining acceptable versions.

Should I add "@lingui/loader" to the rspack example?

Yes please.

Done

@timofei-iatsenko
Copy link
Copy Markdown
Collaborator

I don't mind, but I want to understand. Are you concerned that specifying rspack/rsbuild will lead to new code additions and make maintenance more difficult?

This list is not completed, we will also need to specify turbopack version as webpack compatible (anything else what i'm not aware of?) and maintain the ranges unnecessarily. I believe all these webpack compatible tools is compatible with latest webpack api, so it's on their side to maintain compatibility - not on ours.

@yslpn
Copy link
Copy Markdown
Contributor Author

yslpn commented Apr 14, 2026

I don't mind, but I want to understand. Are you concerned that specifying rspack/rsbuild will lead to new code additions and make maintenance more difficult?

This list is not completed, we will also need to specify turbopack version as webpack compatible (anything else what i'm not aware of?) and maintain the ranges unnecessarily. I believe all these webpack compatible tools is compatible with latest webpack api, so it's on their side to maintain compatibility - not on ours.

Done. Pull request description updated.

@timofei-iatsenko
Copy link
Copy Markdown
Collaborator

@andrii-bodnar all good let's merge this one

@andrii-bodnar andrii-bodnar changed the title fix(loader): support rspack and rsbuild peer dependencies fix(loader): make webpack peer dependency optional and update Rspack example Apr 15, 2026
@andrii-bodnar andrii-bodnar merged commit 2f7b13d into lingui:next Apr 15, 2026
14 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.

3 participants