Add Rspack optional peer dependency for @tailwindcss/webpack#20027
Conversation
Confidence Score: 5/5Safe 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 |
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
WalkthroughThe 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ 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. Comment |
There was a problem hiding this comment.
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
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (2)
packages/@tailwindcss-webpack/README.mdpackages/@tailwindcss-webpack/package.json
There was a problem hiding this comment.
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/webpackREADME and package description to mention Rspack support and provide a Rspack config example. - Add
@rspack/coreas an optional peer dependency for@tailwindcss/webpack(and mark peers as optional viapeerDependenciesMeta). - Update
pnpm-lock.yamlto include@rspack/coreand 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.
There was a problem hiding this comment.
💡 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".
|
@RobinMalfait Could you take a look? ❤️ |
|
Hey! I appreciate the PR, but I'm having a hard time figuring out what the actual benefit is given that This might allow you to not install webpack at all, but since 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 for taking a look! One thing I wanted to mention is that making both
For projects using Rspack, it would be nice if users didn’t need to install Rspack has also become a fairly widely used webpack-compatible bundler, with So my thought was that |
|
@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. |
It's still considered a webpack plugin, but this PR makes it better compatible with Rspack as well, similar to existing loaders in the ecosystem: - https://github.com/webpack/css-loader/blob/main/package.json#L45-L56 - https://github.com/webpack/postcss-loader/blob/main/package.json#L91-L103 - https://github.com/webpack/sass-loader/blob/main/package.json#L93-L112 - https://github.com/webpack/less-loader/blob/main/package.json#L90-L102
6da0f29 to
e6743d4
Compare
|
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! |
|
Thanks a lot! This will be very helpful for Rspack users. |
Summary
This PR makes Rspack support explicit for
@tailwindcss/webpackby adding@rspack/coreas an optional peer dependency alongsidewebpack.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.