alibaba-fusion / next

🦍 A configurable component library for web built on React.
https://fusion.design
MIT License
4.58k stars 584 forks source link

主题包不应该吧 @alifd/next 作为 dependencies #3349

Closed guoyunhe closed 3 years ago

guoyunhe commented 3 years ago

Steps to reproduce

任意创建一个主题包,下载安装,查看 package.json image @alifd/next 已经是 peerDependencies 了,就不应该再作为 dependencies 了。

bindoon commented 3 years ago

放 dependencies 是为了强控制next版本号,主题必须和next版本一直才行。

guoyunhe commented 3 years ago

像 react 和 react-dom 也需要版本一致才行,但也没有因此强制 react 是 react-dom 的依赖。peerDependencies 已经提供了安装时的警告,剩下的就应该靠用户自己来保证了。

bindoon commented 3 years ago

现在有什么问题吗?

guoyunhe commented 3 years ago

主要是觉得不合理。实际生产过程中,总会遇到版本不一致的问题。但是由于使用的组件不多,构建后实际运行效果是好的。

另外,这种强制控制,现实中并不会生效。假如我的 ice.js 项目是这样配置的:

├── @alifd/next@1.19.3 
└─┬ @alife/theme-nice@0.15.7
  └── @alifd/next@1.24.3

ice.js 在构建时,仍然会首选直接安装的版本。但是 tnpm install 的时候却安装了两份 @alifd/next 。从结果上看,只是浪费了安装软件包的时间。

bindoon commented 3 years ago

这个没有致命错误不会再改了,已经有上千个主题包在生成环境了。