From c1d57680b18e7556683939ee0b8a0318ae72ba34 Mon Sep 17 00:00:00 2001 From: neverland Date: Wed, 8 Apr 2026 10:54:05 +0800 Subject: [PATCH] feat!: update default include regex --- README.md | 2 +- src/options.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f4486df..5e166d9 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/src/options.ts b/src/options.ts index 6a62c60..770c59b 100644 --- a/src/options.ts +++ b/src/options.ts @@ -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; @@ -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)$/); d(options, 'library'); d(options, 'forceEnable', false); d(options, 'injectLoader', true);