Skip to main content

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.

\🔌 此重大更改是否会影响插件?\
\🤖 此重大更改是否由 codemod 自动处理?\

重大更改描述

¥Breaking change description

在 Strapi v4 中

¥In Strapi v4

Strapi 维护一个在 webpack 配置中别名化的依赖的特定列表。这可确保插件始终使用某些库(如设计系统)的 Strapi 版本。

¥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 中

¥In Strapi 5

简化了别名过程。只有基本依赖(如 reactreact-domreact-router-domstyled-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 文件中以解决兼容性问题。

    ¥If you encounter issues with 3rd-party plugins, it's recommended you open an issue on the respective plugin's repository. Encourage the plugin maintainers to add their dependencies to their package.json file to resolve compatibility issues.

  • 如果你遇到本地插件的问题,你可以通过修改所选打包器中的 resolve 选项来修复它们。

    ¥If you encounter issues with local plugins, you can fix them by amending the resolve option in your chosen bundler.

手动程序

¥Manual procedure

要迁移到 Strapi 5:

¥To migrate to Strapi 5:

  • 识别引用 Strapi v4 中现已删除的 Webpack 别名的任何配置文件(例如,webpack 配置)。

    ¥Identify any configuration files (e.g., webpack configuration) that referenced the now-removed Webpack aliases in Strapi v4.

  • 确保代码中对 Webpack 别名的任何引用都被替换为适当的导入或路径。

    ¥Ensure that any references to Webpack aliases in the code are replaced with appropriate imports or paths.

  • 如果项目中使用了第三方插件,请验证它们不依赖于 Strapi v5 中不再存在的 Webpack 别名。

    ¥If third-party plugins are used in the project, verify that they do not rely on Webpack aliases that are no longer present in Strapi v5.

  • 如有必要,请与插件作者沟通以相应地更新他们的依赖或配置。

    ¥If necessary, communicate with the plugin authors to update their dependencies or configurations accordingly.