Strapi v4 到 Strapi 5 的重大变更
🌐 Strapi v4 to Strapi 5 breaking changes
本页面列出了 Strapi 5 中引入的所有重大更改。重大更改按主题相关类别分组,在下面表格的每一行中,你将找到:
🌐 The present page lists all the breaking changes introduced in Strapi 5. Breaking changes are grouped into topic-related categories, and for each line in the following tables line you will find:
- 重大更改的简短描述,
- 以及另外两列,“影响插件”和“由 codemods 处理”,总结了破坏性更改是否也影响插件,以及破坏性更改是否由 升级 CLI 工具 的 codemod 自动处理。
你可以单击下表中任何重大更改的描述以跳转到包含更多详细信息的相应页面。
🌐 You can click on the description of any breaking change in the following tables to jump to the corresponding page with more details.
- 要查看可用 codemods 的完整列表,请在终端中运行
npx @strapi/upgrade codemods ls命令。 - 要更深入地查看 codemods 执行的代码,请前往 GitHub 仓库中的 list of codemods 。
数据库
🌐 Database
| 描述 | 影响插件 | 由 codemods 处理 ||-------------|-----------------|---------------------|| 内容类型总是有功能列 | 是 | 否 || 不再支持 MySQL v5 | 否 | 否 || 数据库标识符超过 55 个字符将被自动缩短 | 是 | ✅ 是 || SQLite 客户端仅支持 better-sqlite3 包 | 否 | ✅ 是 || MySQL 客户端仅支持 mysql2 包 | 否 | ✅ 是 |
依赖
🌐 Dependencies
| 描述 | 影响插件 | 由代码修改工具处理 ||-------------|-----------------|---------------------|| CLI 默认的包管理器不再是 yarn | 否 | 否 || Vite 是 Strapi 5 的默认打包工具 | 是 | 否 || Strapi 5 使用 react-router-dom v6 | 是 | ✅ 是 || Strapi 5 使用 koa-body v6 | 是 | 否 || Strapi 5 中移除了 Webpack 别名 | 是 | 否 || Apollo Server v3 升级到 Apollo Server v4 | 是 | 否 |
配置
🌐 Configuration
| 描述 | 影响的插件 | 由代码转换处理 |
|---|---|---|
一些仅适用于 env 的配置选项由服务器配置处理 | 否 | 否 |
| 配置文件名应符合严格要求 | 否 | 否 |
服务器日志级别是 http | 否 | 否 |
| 模型配置路径使用 UID 而不是点表示法 | 是 | 👷 部分 |
webhooks.populateRelations 服务器配置已删除 | 是 | 否 |
在 public 中移除了 defaultIndex 选项 | 否 | 否 |
服务器代理配置选项分组在 server.proxy 对象下 | 否 | 否 |
Strapi 对象、方法、包和后端自定义
🌐 Strapi objects, methods, packages, and back-end customization
| 描述 | 影响插件 | 由代码修改工具处理 ||-------------|-----------------|---------------------|| strapi.fetch 使用原生 fetch() API | 是 | 否 || strapi 工厂导入已更改 | 是 | 👷 部分 || isSupportedImage 方法在 Strapi 5 中已移除 | 是 | 否 || strapi-utils 已被重构 | 是 | ✅ 是 || 核心服务方法使用 Document Service API | 是 | 否 || i18n 现在是 strapi 核心的一部分 | 是 | ✅ 是 |
插件、提供商、管理面板和前端自定义
🌐 Plugins, providers, admin panel and front-end customization
内容 API
🌐 Content API