Skip to content

Commit ba3eabc

Browse files
authored
docs: clarify watchFiles glob path separators (#8152)
1 parent 5a35365 commit ba3eabc

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

website/docs/en/config/dev/watch-files.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ export default {
6464
};
6565
```
6666

67+
:::tip
68+
Glob patterns should use forward slashes (`/`) as path separators on all platforms. Avoid using `path.join()` to construct glob patterns because it produces backslashes on Windows, where backslashes are interpreted as escape characters in glob syntax.
69+
70+
Use a string literal or `path.posix.join()` to construct relative glob patterns.
71+
:::
72+
6773
## type
6874

6975
- **Type:** `'reload-page' | 'restart' | 'reload-server'`

website/docs/zh/config/dev/watch-files.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ export default {
6464
};
6565
```
6666

67+
:::tip
68+
在所有平台上,glob 模式都应使用正斜杠(`/`)作为路径分隔符。请勿使用 `path.join()` 构造 glob 模式,因为它在 Windows 上会生成反斜杠,而反斜杠在 glob 语法中会被解释为转义符。
69+
70+
请使用字符串字面量或 `path.posix.join()` 构造相对 glob 模式。
71+
:::
72+
6773
## type
6874

6975
- **类型:** `'reload-page' | 'restart' | 'reload-server'`

0 commit comments

Comments
 (0)