# 监视管理员模式默认是开启的

> Source: https://strapi.nodejs.cn/cms/migration/v4-to-v5/breaking-changes/watch-admin-enabled-by-default

🌐 The watch-admin mode is enabled by default

在 Strapi 5 中，`strapi develop` 默认以 watch-admin 模式启动，所以管理面板会自动热重载，无需额外的标志。使用 `--no-watch-admin` 可以禁用它。

🌐 In Strapi 5, `strapi develop` starts in watch-admin mode by default, so the admin panel hot reloads without any additional flag. Use `--no-watch-admin` to disable it.

Watch-admin 模式会在你编辑管理面板的源文件时自动重新加载。在 Strapi v4 中，你需要明确要求这种行为，而在 Strapi 5 中默认就会这样，你可以选择关闭。

🌐 Watch-admin mode reloads the admin panel automatically while you edit its source files. In Strapi v4 you had to ask for this behavior explicitly, while in Strapi 5 you get it by default and opt out instead.

此页面是[重大更改数据库](/cms/migration/v4-to-v5/breaking-changes)的一部分，提供关于重大更改的信息以及从 Strapi v4 迁移到 Strapi 5 的附加说明。

🌐 This page is part of the [breaking changes database](/cms/migration/v4-to-v5/breaking-changes) and provides information about the breaking change and additional instructions to migrate from Strapi v4 to Strapi 5.

- Is this breaking change affecting plugins? No
- Is this breaking change automatically handled by a codemod? No

## 重大变更描述 {#breaking-change-description}

🌐 Breaking change description

**在 Strapi v4 中**

观看管理员模式默认是关闭的。你可以用 `--watch-admin` 标志来开启它：

🌐 Watch-admin mode is disabled by default. You start it with the `--watch-admin` flag:

```bash
strapi develop --watch-admin
```

也有一个单独的 `strapi watch-admin` 命令可用。

🌐 A separate `strapi watch-admin` command is also available.

**在 Strapi 5 中**

Watch-admin 模式默认开启，所以只用 `strapi develop` 就可以热重载管理面板。`--no-watch-admin` 标志可以禁用它：

🌐 Watch-admin mode is enabled by default, so `strapi develop` alone hot reloads the admin panel. The `--no-watch-admin` flag disables it:

```bash
strapi develop --no-watch-admin
```

独立的 `strapi watch-admin` 命令已被移除。

🌐 The standalone `strapi watch-admin` command is removed.

## 迁移 {#migration}

🌐 Migration

本节重新组合了有关引入的重大更改的有用说明和程序。

🌐 This section regroups useful notes and procedures about the introduced breaking change.

### 注意 {#notes}

🌐 Notes

在 Strapi 5 中传入 `--watch-admin` 并不是错误，因为这个标志仍然存在并且已经默认是 `true`。使用它的脚本仍然可以正常工作，但这个标志已经没有必要了。

🌐 Passing `--watch-admin` in Strapi 5 is not an error, since the flag still exists and already defaults to `true`. Scripts that use it keep working, but the flag is redundant.

如果禁用了 watch-admin 模式，你也可以使用 `--no-build-admin` 来阻止管理面板的构建。

🌐 If watch-admin mode is disabled, you can also use `--no-build-admin` to prevent the admin panel from being built.

### 手动迁移 {#manual-migration}

🌐 Manual migration

要迁移到 Strapi 5：

🌐 To migrate to Strapi 5:

1. 在你的 `package.json` 脚本、Dockerfiles 和 CI 配置文件中搜索 `--watch-admin` 和 `strapi watch-admin`。
2. 将任何 `strapi watch-admin` 命令替换为 `strapi develop`。
3. 现在可以移除多余的 `--watch-admin` 标志，当然如果你喜欢明确一点，也可以保留它们。
4. 将 `--no-watch-admin` 添加到那些不能热重载管理面板的命令中，比如之前依赖于默认关闭 watch-admin 模式的脚本。

:::note

查看 [CLI 参考](/cms/cli#strapi-develop) 了解 `strapi develop` 命令支持的所有选项。

🌐 See the [CLI reference](/cms/cli#strapi-develop) for the full list of options accepted by the `strapi develop` command.

:::
