Webpack 别名已被移除
🌐 Webpack Aliases are removed
在 Strapi v5 中,删除了 webpack 别名,以确保更好的兼容性并减少依赖冲突。
🌐 In Strapi v5, webpack aliases are removed ensuring better compatibility and reduced dependency conflicts.
此页面是重大更改数据库的一部分,提供关于重大更改的信息以及从 Strapi v4 迁移到 Strapi 5 的附加说明。
🌐 This page is part of the breaking changes database and provides information about the breaking change and additional instructions to migrate from Strapi v4 to Strapi 5.
重大变更描述
🌐 Breaking change description
在 Strapi v4 中
Strapi 维护一个在 webpack 配置中被别名化的特定依赖列表。这确保了插件始终使用 Strapi 版本的某些库,例如 design-system。
🌐 Strapi maintains a specific list of dependencies that are aliased in webpack configuration. This ensures that plugins consistently use Strapi versions of certain libraries like the design-system.
在 Strapi 5 中
别名化过程被简化。只有像 react、react-dom、react-router-dom 和 styled-components 这样的必要依赖被别名化。
🌐 The aliasing process is simplified. Only essential dependencies like react, react-dom, react-router-dom, and styled-components are aliased.
迁移
🌐 Migration
本节重新组合了有关引入的重大更改的有用说明和程序。
🌐 This section regroups useful notes and procedures about the introduced breaking change.
注意
🌐 Notes
- 如果你遇到第三方插件的问题,建议你在相应插件的仓库中提交一个问题。鼓励插件维护者将他们的依赖添加到他们的
package.json文件中以解决兼容性问题。 - 如果你在使用本地插件时遇到问题,可以通过修改所选打包工具中的
resolve选项来解决。
手动操作
🌐 Manual procedure
要迁移到 Strapi 5:
🌐 To migrate to Strapi 5:
- 识别引用 Strapi v4 中现已删除的 Webpack 别名的任何配置文件(例如,webpack 配置)。
- 确保代码中对 Webpack 别名的任何引用都被替换为适当的导入或路径。
- 如果项目中使用了第三方插件,请验证它们不依赖于 Strapi v5 中不再存在的 Webpack 别名。
- 如有必要,请与插件作者沟通以相应地更新他们的依赖或配置。