Skip to content

Add Rspack optional peer dependency for @tailwindcss/webpack#20027

Merged
RobinMalfait merged 4 commits into
tailwindlabs:mainfrom
chenjiahan:add_rspack_peer
May 23, 2026
Merged

Add Rspack optional peer dependency for @tailwindcss/webpack#20027
RobinMalfait merged 4 commits into
tailwindlabs:mainfrom
chenjiahan:add_rspack_peer

Conversation

@chenjiahan

Copy link
Copy Markdown
Contributor

Summary

This PR makes Rspack support explicit for @tailwindcss/webpack by adding @rspack/core as an optional peer dependency alongside webpack.

The loader already works through Rspack's webpack-compatible loader API, as shown in this runnable example: https://github.com/rstackjs/rstack-examples/tree/main/rspack/tailwindcss. The README and package description are updated to document that usage.

Test plan

No Rspack-specific tests were added. The loader implementation is unchanged, and the existing webpack loader tests exercise the same loader API path that Rspack uses, which should cover the relevant behavior.

Copilot AI review requested due to automatic review settings May 8, 2026 14:07
@chenjiahan chenjiahan requested a review from a team as a code owner May 8, 2026 14:07
@greptile-apps

greptile-apps Bot commented May 8, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

Safe to merge — only package metadata and changelog are touched; the loader implementation is completely unchanged.

The diff is limited to adding an optional peer dependency entry and a changelog line. No runtime code paths are affected, and the existing webpack tests continue to cover the loader API that Rspack uses.

No files require special attention.

Reviews (8): Last reviewed commit: "update changelog" | Re-trigger Greptile

Comment thread packages/@tailwindcss-webpack/package.json
Comment thread packages/@tailwindcss-webpack/README.md Outdated
@coderabbitai

coderabbitai Bot commented May 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: fe853343-50f1-4fb2-a11c-15bdca201111

📥 Commits

Reviewing files that changed from the base of the PR and between e6743d4 and 450ba0a.

📒 Files selected for processing (1)
  • CHANGELOG.md
✅ Files skipped from review due to trivial changes (1)
  • CHANGELOG.md

Walkthrough

The @tailwindcss/webpack package.json is updated to support both webpack and Rspack as optional peer dependencies. The webpack peer dependency is updated from ^5 to ^5.0.0, and a new @rspack/core peer dependency (^1.0.0 || ^2.0.0) is added. A peerDependenciesMeta section marks both dependencies as optional, allowing the package to work with either bundler independently. A CHANGELOG entry was added under Unreleased → Fixed noting the Rspack installation fix.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding Rspack as an optional peer dependency for the @tailwindcss/webpack package.
Description check ✅ Passed The description provides relevant context about the PR, explaining why Rspack support is being added, referencing an existing runnable example, and detailing the testing approach.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/`@tailwindcss-webpack/package.json:
- Around line 47-53: The package marks both "webpack" and "@rspack/core" as
optional peer dependencies in packages/@tailwindcss-webpack/package.json, so add
a clear note to the README installation section for the `@tailwindcss/webpack`
package that users must install at least one bundler (either webpack or
`@rspack/core`) before using the loader; update the installation/usage docs
(README) to state this requirement, show example install commands for both
options (npm/yarn/pnpm), and warn that omitting both will cause a runtime error
when the loader (the `@tailwindcss/webpack` package) is invoked.

In `@packages/`@tailwindcss-webpack/README.md:
- Around line 73-88: The example in rspack.config.js uses ESM import/export
(import { rspack } from '@rspack/core'; export default { ... }) which will throw
for projects without "type": "module"; fix by changing the snippet to a CommonJS
form (use require('...') and module.exports = ...) or instruct readers to rename
the file to rspack.config.mjs or add "type": "module" in package.json; update
the README around the rspack and CssExtractRspackPlugin example to present one
of these safe alternatives and mention the requirement for ESM if keeping
import/export.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: ccad69dd-9633-4f57-9ac9-9a12096e15d3

📥 Commits

Reviewing files that changed from the base of the PR and between c00da89 and 96206a1.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (2)
  • packages/@tailwindcss-webpack/README.md
  • packages/@tailwindcss-webpack/package.json

Comment thread packages/@tailwindcss-webpack/package.json
Comment thread packages/@tailwindcss-webpack/README.md Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR makes Rspack support explicit for @tailwindcss/webpack by documenting Rspack usage and adding @rspack/core as an optional peer dependency so Rspack projects don’t see incorrect peer warnings.

Changes:

  • Update @tailwindcss/webpack README and package description to mention Rspack support and provide a Rspack config example.
  • Add @rspack/core as an optional peer dependency for @tailwindcss/webpack (and mark peers as optional via peerDependenciesMeta).
  • Update pnpm-lock.yaml to include @rspack/core and its resolved dependencies.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 4 comments.

File Description
pnpm-lock.yaml Adds lock entries for @rspack/core and associated packages as part of making Rspack support explicit.
packages/@tailwindcss-webpack/README.md Documents Rspack usage alongside webpack and updates the short package description text.
packages/@tailwindcss-webpack/package.json Updates package description and declares @rspack/core (and webpack) in peer dependency metadata.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/@tailwindcss-webpack/package.json
Comment thread packages/@tailwindcss-webpack/README.md Outdated
Comment thread packages/@tailwindcss-webpack/README.md Outdated
Comment thread pnpm-lock.yaml

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 927ff7234f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/@tailwindcss-webpack/README.md Outdated
@chenjiahan

Copy link
Copy Markdown
Contributor Author

@RobinMalfait Could you take a look? ❤️

@RobinMalfait

Copy link
Copy Markdown
Member

Hey! I appreciate the PR, but I'm having a hard time figuring out what the actual benefit is given that @tailwindcss/webpack already works in an Rspack project?

This might allow you to not install webpack at all, but since css-loader is also required and depends on webpack you will get webpack anyway during the installation process.

There are a few webpack drop-in replacements today, and adding all of them as optional peer dependencies seems a bit too much. Especially in a time where supply chain attacks happen left and right, I think it's better to reduce the amount of dependencies, especially since it already works as-is today.

Going to close this for now, we can revisit this if this causes any issues.
Thanks again for the PR!

@chenjiahan

Copy link
Copy Markdown
Contributor Author

Thanks for taking a look!

One thing I wanted to mention is that making both webpack and @rspack/core optional peer dependencies is a common pattern across many webpack/Rspack loaders, including the ones maintained by the webpack team:

For projects using Rspack, it would be nice if users didn’t need to install webpack just to satisfy the peer dependency, since that would add an extra dependency that isn’t actually used.

Rspack has also become a fairly widely used webpack-compatible bundler, with @rspack/core now seeing over 6M weekly downloads on npm: https://www.npmjs.com/package/@rspack/core

So my thought was that @tailwindcss/webpack could follow the same pattern as those loaders and make the integration work a bit more smoothly for Rspack users.

@chenjiahan

Copy link
Copy Markdown
Contributor Author

@RobinMalfait Would you be open to reopening this PR and continuing the discussion? We’d be happy to adjust the approach in any way that makes this more acceptable.

@RobinMalfait RobinMalfait reopened this May 23, 2026
@RobinMalfait

Copy link
Copy Markdown
Member

Alright you convinced me, I've re-opened the PR to update the peer dependencies. I did clean up some of the readme to keep it simple since it's still mainly considered a webpack plugin. People using Rspack will know how to translate this config.

Thanks for the PR!

@RobinMalfait RobinMalfait enabled auto-merge (squash) May 23, 2026 09:14
@RobinMalfait RobinMalfait merged commit 982e920 into tailwindlabs:main May 23, 2026
9 checks passed
@chenjiahan

Copy link
Copy Markdown
Contributor Author

Thanks a lot! This will be very helpful for Rspack users.

@chenjiahan chenjiahan deleted the add_rspack_peer branch May 23, 2026 13:50
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