File tree Expand file tree Collapse file tree
fixtures/contains-node_modules-name Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -119,13 +119,13 @@ new ReactRefreshPlugin({
119119### exclude
120120
121121- Type: [ Rspack.RuleSetCondition] ( https://rspack.rs/config/module-rules#condition )
122- - Default: ` /node_modules/ `
122+ - Default: ` /[\\/] node_modules[\\/] / `
123123
124124Exclude files from being processed by the plugin. The value is the same as the [ rule.exclude] ( https://rspack.rs/config/module-rules#rulesexclude ) option in Rspack.
125125
126126``` js
127127new ReactRefreshPlugin ({
128- exclude: [/ node_modules/ , / some-other-module/ ],
128+ exclude: [/ [ \\ /] node_modules[ \\ /] / , / some-other-module/ ],
129129});
130130```
131131
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ export type PluginOptions = {
2121 /**
2222 * Exclude files from being processed by the plugin.
2323 * The value is the same as the `rule.exclude` option in Rspack.
24- * @default /node_modules/
24+ * @default /[\\/] node_modules[\\/] /
2525 * @see https://rspack.rs/config/module-rules#rulesexclude
2626 */
2727 exclude ?: RuleSetCondition | null ;
@@ -95,7 +95,7 @@ export function normalizeOptions(
9595 options : PluginOptions ,
9696) : NormalizedPluginOptions {
9797 d ( options , 'test' , / \. (?: j s | j s x | m j s | c j s | t s | t s x | m t s | c t s ) $ / ) ;
98- d ( options , 'exclude' , / n o d e _ m o d u l e s / i ) ;
98+ d ( options , 'exclude' , / [ \\ / ] n o d e _ m o d u l e s [ \\ / ] / ) ;
9999 d ( options , 'library' ) ;
100100 d ( options , 'forceEnable' , false ) ;
101101 d ( options , 'injectLoader' , true ) ;
Original file line number Diff line number Diff line change 1+ import 'foo' ;
2+
3+ export default 'contains-node_modules-name' ;
Original file line number Diff line number Diff line change @@ -160,6 +160,16 @@ describe('react-refresh-rspack-plugin', () => {
160160 expect ( fixture ) . toContain ( 'function $RefreshReg$' ) ;
161161 } ) ;
162162
163+ it ( 'should include paths that only contain node_modules in the name' , async ( ) => {
164+ const {
165+ outputs : { fixture } ,
166+ } = await compileWithReactRefresh (
167+ path . join ( import . meta. dirname , 'fixtures/contains-node_modules-name' ) ,
168+ { } ,
169+ ) ;
170+ expect ( fixture ) . toContain ( 'function $RefreshReg$' ) ;
171+ } ) ;
172+
163173 it ( 'should add library to make sure work in Micro-Frontend' , async ( ) => {
164174 const {
165175 outputs : { reactRefresh } ,
You can’t perform that action at this time.
0 commit comments