feat: add optional peer dependency for @rspack/core#96
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the plugin’s published metadata and documentation to clarify Rspack version compatibility and peer dependency expectations for @rspack/plugin-react-refresh.
Changes:
- Adds a “Versions” section to the README describing which major versions map to Rspack v1 vs v2.
- Adds
@rspack/coreas an (optional) peer dependency alongsidereact-refresh.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| README.md | Documents a major-version compatibility matrix and links to v1 usage guidance. |
| package.json | Declares @rspack/core as an optional peer dependency. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - `2.x`: For Rspack v2. | ||
| - `1.x`: For Rspack v1, see [v1.x - README](https://github.com/rstackjs/rspack-dev-server/tree/v1.x#rspackdev-server) for usage guide. |
There was a problem hiding this comment.
The new “Versions” section implies that users should install 2.x for Rspack v2, but this package is currently version 1.6.2 (see package.json). Either update the mapping to reflect the actual published major versions, or bump the package to 2.x as part of this change so the documentation stays accurate.
| - `2.x`: For Rspack v2. | |
| - `1.x`: For Rspack v1, see [v1.x - README](https://github.com/rstackjs/rspack-dev-server/tree/v1.x#rspackdev-server) for usage guide. | |
| - `1.x`: For Rspack v2. | |
| - For Rspack v1, use the matching older release and refer to that release's README for the appropriate usage guide. |
| ## Versions | ||
|
|
||
| - `2.x`: For Rspack v2. | ||
| - `1.x`: For Rspack v1, see [v1.x - README](https://github.com/rstackjs/rspack-dev-server/tree/v1.x#rspackdev-server) for usage guide. |
There was a problem hiding this comment.
The 1.x usage-guide link points to the rstackjs/rspack-dev-server repository and the #rspackdev-server anchor, which appears unrelated to this plugin. Please update it to the correct location for the @rspack/plugin-react-refresh v1.x documentation (likely this repo’s v1.x branch README, with the right anchor).
| - `1.x`: For Rspack v1, see [v1.x - README](https://github.com/rstackjs/rspack-dev-server/tree/v1.x#rspackdev-server) for usage guide. | |
| - `1.x`: For Rspack v1, see [v1.x - README](https://github.com/web-infra-dev/rspack/tree/v1.x/packages/rspack-plugin-react-refresh#readme) for usage guide. |
| "peerDependenciesMeta": { | ||
| "@rspack/core": { | ||
| "optional": true | ||
| } | ||
| }, |
There was a problem hiding this comment.
@rspack/core is referenced in exported type declarations (e.g., import type { Compiler } from '@rspack/core'), so TypeScript consumers without @rspack/core installed will get “Cannot find module '@rspack/core'” errors. Marking it as an optional peer can hide the missing-peer warning from package managers; consider making it a required peer, or explicitly documenting when/why consumers can omit it (e.g., JS-only usage).
| "peerDependenciesMeta": { | |
| "@rspack/core": { | |
| "optional": true | |
| } | |
| }, |
Updates the documentation and package configuration to clarify version compatibility and peer dependency requirements for the React refresh plugin for Rspack.