Skip to content

Commit 1f5a44a

Browse files
authored
feat!: update default include regex (#99)
1 parent f088f5c commit 1f5a44a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ new ReactRefreshPlugin({
104104
### include
105105

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

109109
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.
110110

src/options.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export type PluginOptions = {
1313
* This option is passed to the `builtin:react-refresh-loader` as the `rule.include` condition.
1414
* Use this to limit processing to specific directories or file patterns.
1515
* Works identically to Rspack's `rule.include` option.
16-
* @default /\.([cm]js|[jt]sx?|flow)$/i
16+
* @default /\.(?:js|jsx|mjs|cjs|ts|tsx|mts|cts)$/
1717
* @see https://rspack.rs/config/module-rules#rulesinclude
1818
*/
1919
include?: RuleSetCondition | null;
@@ -94,7 +94,7 @@ export function normalizeOptions(
9494
options: PluginOptions,
9595
): NormalizedPluginOptions {
9696
d(options, 'exclude', /node_modules/i);
97-
d(options, 'include', /\.([cm]js|[jt]sx?|flow)$/i);
97+
d(options, 'include', /\.(?:js|jsx|mjs|cjs|ts|tsx|mts|cts)$/);
9898
d(options, 'library');
9999
d(options, 'forceEnable', false);
100100
d(options, 'injectLoader', true);

0 commit comments

Comments
 (0)