Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ new ReactRefreshPlugin({
### include

- Type: [Rspack.RuleSetCondition](https://rspack.rs/config/module-rules#condition)
- Default: `/\.([cm]js|[jt]sx?|flow)$/i`
- Default: `/\.(?:js|jsx|mjs|cjs|ts|tsx|mts|cts)$/`

Explicitly includes files to be processed by the React Refresh loader. This option is passed to the `builtin:react-refresh-loader` as the `rule.include` condition.

Expand Down
4 changes: 2 additions & 2 deletions src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export type PluginOptions = {
* This option is passed to the `builtin:react-refresh-loader` as the `rule.include` condition.
* Use this to limit processing to specific directories or file patterns.
* Works identically to Rspack's `rule.include` option.
* @default /\.([cm]js|[jt]sx?|flow)$/i
* @default /\.(?:js|jsx|mjs|cjs|ts|tsx|mts|cts)$/
* @see https://rspack.rs/config/module-rules#rulesinclude
*/
include?: RuleSetCondition | null;
Expand Down Expand Up @@ -94,7 +94,7 @@ export function normalizeOptions(
options: PluginOptions,
): NormalizedPluginOptions {
d(options, 'exclude', /node_modules/i);
d(options, 'include', /\.([cm]js|[jt]sx?|flow)$/i);
d(options, 'include', /\.(?:js|jsx|mjs|cjs|ts|tsx|mts|cts)$/);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Restore case-insensitive default include regex

The new default include pattern is now case-sensitive, so files like Component.TSX or App.JS no longer match and won’t get builtin:react-refresh-loader applied. This is a regression from the previous /.../i behavior and can silently disable Fast Refresh in projects that use uppercase or mixed-case extensions (common on case-insensitive filesystems or legacy repos).

Useful? React with 👍 / 👎.

d(options, 'library');
d(options, 'forceEnable', false);
d(options, 'injectLoader', true);
Expand Down
Loading