Skip to content

fix: narrow default node_modules exclude#123

Merged
chenjiahan merged 1 commit into
mainfrom
chenjiahan/fix-node-modules-exclude
Jun 1, 2026
Merged

fix: narrow default node_modules exclude#123
chenjiahan merged 1 commit into
mainfrom
chenjiahan/fix-node-modules-exclude

Conversation

@chenjiahan
Copy link
Copy Markdown
Member

Summary

This PR narrows the default exclude option so React Refresh skips only real node_modules path segments instead of any path containing the node_modules substring. It also updates the README default and adds coverage for paths whose names merely contain node_modules.

Copilot AI review requested due to automatic review settings June 1, 2026 14:17
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refines the plugin’s default exclude behavior so React Refresh ignores only true node_modules path segments (instead of any path containing the substring), and updates documentation/tests to reflect and validate that behavior.

Changes:

  • Narrow default exclude from a broad /node_modules/i-style match to a path-segment match (/[\\/]node_modules[\\/]/).
  • Add a regression test + fixture to ensure paths whose names merely contain node_modules are still processed.
  • Update README to document the new default and example configuration.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
src/options.ts Updates the default exclude regex used during options normalization and documents it in JSDoc.
README.md Updates the documented default exclude and example patterns to match the new behavior.
test/test.spec.ts Adds coverage for paths that contain node_modules as part of a directory name (not as a segment).
test/fixtures/contains-node_modules-name/index.js Adds a new fixture used by the regression test.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/options.ts
Comment on lines 97 to 99
d(options, 'test', /\.(?:js|jsx|mjs|cjs|ts|tsx|mts|cts)$/);
d(options, 'exclude', /node_modules/i);
d(options, 'exclude', /[\\/]node_modules[\\/]/);
d(options, 'library');
Comment thread src/options.ts
Comment thread README.md
Comment thread README.md
@chenjiahan chenjiahan merged commit 785e0df into main Jun 1, 2026
5 checks passed
@chenjiahan chenjiahan deleted the chenjiahan/fix-node-modules-exclude branch June 1, 2026 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants