The content of this section is derived from the content of the following links and is subject to the CC BY 4.0 license.
The following contents can be assumed to be the result of modifications and deletions based on the original contents if not specifically stated.
Rspack can watch files and recompile whenever they change.
booleanfalseTurn on watch mode. This means that after the initial build, Rspack will continue to watch for changes in any of the resolved files.
watch is enabled by default when using @rspack/dev-server.
objectA set of options used to customize watch mode.
number5Add a delay before rebuilding once the first file changed. This allows Rspack to aggregate any other changes made during this time period into one rebuild. Pass a value in milliseconds:
RegExp, string, string[]undefinedThe path that matches is excluded while watching. Watching many files can result in a lot of CPU or memory usage, it is recommended to exclude a huge folder like node_modules and .git using a regular expression:
Alternatively, a glob pattern may be used:
It is also possible to use multiple glob patterns:
In addition, you can specify one or more absolute paths:
When using glob patterns, Rspack convert them to regular expressions with glob-to-regexp, so make sure to get yourself familiar with it before you use glob patterns for watchOptions.ignored.
boolean, numberfalseWhether to watch by polling.
When set to true, the default polling interval is 5007 milliseconds.
It can also set a custom polling interval:
booleanfalseFollow symbolic links while looking for a file. This is usually not needed as Rspack already resolves symlinks with resolve.symlinks.
booleanStop watching when stdin stream has ended.