Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: watchOptions.ignored use array glob instead of regexp #4075

Closed
wants to merge 2 commits into from
Closed
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
5 changes: 5 additions & 0 deletions .changeset/sharp-bikes-shout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rsbuild/core': patch
---

fix: watchOptions.ignored use array glob instead of regexp
20 changes: 16 additions & 4 deletions packages/compat/webpack/tests/__snapshots__/default.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,10 @@ exports[`applyDefaultPlugins > should apply default plugins correctly 1`] = `
],
"watchOptions": {
"aggregateTimeout": 0,
"ignored": /\\[\\\\\\\\/\\]\\(\\?:\\\\\\.git\\|node_modules\\)\\[\\\\\\\\/\\]/,
"ignored": [
"**/.git/**",
"**/node_modules/**",
],
},
}
`;
Expand Down Expand Up @@ -777,7 +780,10 @@ exports[`applyDefaultPlugins > should apply default plugins correctly when produ
],
"watchOptions": {
"aggregateTimeout": 0,
"ignored": /\\[\\\\\\\\/\\]\\(\\?:\\\\\\.git\\|node_modules\\)\\[\\\\\\\\/\\]/,
"ignored": [
"**/.git/**",
"**/node_modules/**",
],
},
}
`;
Expand Down Expand Up @@ -1110,7 +1116,10 @@ exports[`applyDefaultPlugins > should apply default plugins correctly when targe
"target": "node",
"watchOptions": {
"aggregateTimeout": 0,
"ignored": /\\[\\\\\\\\/\\]\\(\\?:\\\\\\.git\\|node_modules\\)\\[\\\\\\\\/\\]/,
"ignored": [
"**/.git/**",
"**/node_modules/**",
],
},
}
`;
Expand Down Expand Up @@ -1432,7 +1441,10 @@ exports[`applyDefaultPlugins > should apply default plugins correctly when targe
],
"watchOptions": {
"aggregateTimeout": 0,
"ignored": /\\[\\\\\\\\/\\]\\(\\?:\\\\\\.git\\|node_modules\\)\\[\\\\\\\\/\\]/,
"ignored": [
"**/.git/**",
"**/node_modules/**",
],
},
}
`;
2 changes: 1 addition & 1 deletion packages/core/src/plugins/basic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const pluginBasic = (): RsbuildPlugin => ({

chain.watchOptions({
// Ignore watching files in node_modules to reduce memory usage and make startup faster
ignored: /[\\/](?:\.git|node_modules)[\\/]/,
ignored: ['**/.git/**', '**/node_modules/**'],
// Remove the delay before rebuilding once the first file changed
aggregateTimeout: 0,
});
Expand Down
10 changes: 8 additions & 2 deletions packages/core/tests/__snapshots__/basic.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ exports[`plugin-basic > should apply basic config correctly in development 1`] =
],
"watchOptions": {
"aggregateTimeout": 0,
"ignored": /\\[\\\\\\\\/\\]\\(\\?:\\\\\\.git\\|node_modules\\)\\[\\\\\\\\/\\]/,
"ignored": [
"**/.git/**",
"**/node_modules/**",
],
},
}
`;
Expand Down Expand Up @@ -59,7 +62,10 @@ exports[`plugin-basic > should apply basic config correctly in production 1`] =
],
"watchOptions": {
"aggregateTimeout": 0,
"ignored": /\\[\\\\\\\\/\\]\\(\\?:\\\\\\.git\\|node_modules\\)\\[\\\\\\\\/\\]/,
"ignored": [
"**/.git/**",
"**/node_modules/**",
],
},
}
`;
5 changes: 4 additions & 1 deletion packages/core/tests/__snapshots__/builder.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,10 @@ exports[`should use Rspack as the default bundler > apply Rspack correctly 1`] =
],
"watchOptions": {
"aggregateTimeout": 0,
"ignored": /\\[\\\\\\\\/\\]\\(\\?:\\\\\\.git\\|node_modules\\)\\[\\\\\\\\/\\]/,
"ignored": [
"**/.git/**",
"**/node_modules/**",
],
},
}
`;
20 changes: 16 additions & 4 deletions packages/core/tests/__snapshots__/default.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,10 @@ exports[`applyDefaultPlugins > should apply default plugins correctly 1`] = `
],
"watchOptions": {
"aggregateTimeout": 0,
"ignored": /\\[\\\\\\\\/\\]\\(\\?:\\\\\\.git\\|node_modules\\)\\[\\\\\\\\/\\]/,
"ignored": [
"**/.git/**",
"**/node_modules/**",
],
},
}
`;
Expand Down Expand Up @@ -873,7 +876,10 @@ exports[`applyDefaultPlugins > should apply default plugins correctly when prod
],
"watchOptions": {
"aggregateTimeout": 0,
"ignored": /\\[\\\\\\\\/\\]\\(\\?:\\\\\\.git\\|node_modules\\)\\[\\\\\\\\/\\]/,
"ignored": [
"**/.git/**",
"**/node_modules/**",
],
},
}
`;
Expand Down Expand Up @@ -1225,7 +1231,10 @@ exports[`applyDefaultPlugins > should apply default plugins correctly when targe
"target": "node",
"watchOptions": {
"aggregateTimeout": 0,
"ignored": /\\[\\\\\\\\/\\]\\(\\?:\\\\\\.git\\|node_modules\\)\\[\\\\\\\\/\\]/,
"ignored": [
"**/.git/**",
"**/node_modules/**",
],
},
}
`;
Expand Down Expand Up @@ -1661,7 +1670,10 @@ exports[`tools.rspack > should match snapshot 1`] = `
],
"watchOptions": {
"aggregateTimeout": 0,
"ignored": /\\[\\\\\\\\/\\]\\(\\?:\\\\\\.git\\|node_modules\\)\\[\\\\\\\\/\\]/,
"ignored": [
"**/.git/**",
"**/node_modules/**",
],
},
}
`;
10 changes: 8 additions & 2 deletions packages/core/tests/__snapshots__/environments.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1528,7 +1528,10 @@ exports[`environment config > tools.rspack / bundlerChain can be configured in e
],
"watchOptions": {
"aggregateTimeout": 0,
"ignored": /\\[\\\\\\\\/\\]\\(\\?:\\\\\\.git\\|node_modules\\)\\[\\\\\\\\/\\]/,
"ignored": [
"**/.git/**",
"**/node_modules/**",
],
},
},
{
Expand Down Expand Up @@ -1858,7 +1861,10 @@ exports[`environment config > tools.rspack / bundlerChain can be configured in e
"target": "node",
"watchOptions": {
"aggregateTimeout": 0,
"ignored": /\\[\\\\\\\\/\\]\\(\\?:\\\\\\.git\\|node_modules\\)\\[\\\\\\\\/\\]/,
"ignored": [
"**/.git/**",
"**/node_modules/**",
],
},
},
]
Expand Down
Loading