You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/migrate-v1-to-v2.md
+44Lines changed: 44 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -77,6 +77,48 @@ export default {
77
77
};
78
78
```
79
79
80
+
### Updated `chokidar` to v5
81
+
82
+
`@rspack/dev-server` v2 upgrades the underlying file watcher `chokidar` from v3 to v5.
83
+
84
+
One important breaking change in `chokidar` v4+ is that [glob patterns are no longer supported](https://github.com/paulmillr/chokidar#upgrading).
85
+
86
+
If you previously passed glob patterns such as `**/*.js` or `./directory/**/*` to `devServer.watchFiles`, you can watch a directory and filter with `ignored`:
87
+
88
+
```js
89
+
// Before
90
+
exportdefault {
91
+
devServer: {
92
+
watchFiles:'**/*.js',
93
+
},
94
+
};
95
+
96
+
// After
97
+
exportdefault {
98
+
devServer: {
99
+
watchFiles: {
100
+
paths:'.',
101
+
options: {
102
+
ignored: (path, stats) =>
103
+
stats?.isFile() &&!path.endsWith('.js'),
104
+
},
105
+
},
106
+
},
107
+
};
108
+
```
109
+
110
+
Or use `node:fs/promises` to expand the glob first:
111
+
112
+
```js
113
+
import { glob } from'node:fs/promises';
114
+
115
+
exportdefaultasync () => ({
116
+
devServer: {
117
+
watchFiles:awaitArray.fromAsync(glob('**/*.js')),
118
+
},
119
+
});
120
+
```
121
+
80
122
### Removed `spdy` support
81
123
82
124
- `server.type:"spdy"` is no longer supported.
@@ -108,6 +150,8 @@ export default {
108
150
};
109
151
```
110
152
153
+
> `Array.fromAsync()` requires Node.js 22+.
154
+
111
155
### Optional `selfsigned` peer dependency
112
156
113
157
`selfsigned` is no longer bundled as a direct dependency of `@rspack/dev-server`.
// TODO: we respect these options for all watch options and allow developers to pass them to chokidar, but chokidar doesn't have these options maybe we need revisit that in future
0 commit comments