Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhance] 包体积优化 #253

Open
fengzilong opened this issue Nov 11, 2021 · 5 comments
Open

[Enhance] 包体积优化 #253

fengzilong opened this issue Nov 11, 2021 · 5 comments
Assignees

Comments

@fengzilong
Copy link

  • src/utils 发成 npm 包
    原因:在构建产物中 promisify 代码重复出现了很多次,在仓库中尝试搜索 utils/promisify 可以发现 20+ 处引用
@imsobear
Copy link
Contributor

除了 promisify 还有其他的吗?建议单独发 @uni/util-promisify ,防止单独一个 utils 包后面越来越臃肿。

@fengzilong
Copy link
Author

fengzilong commented Nov 11, 2021

除了 promisify 还有其他的吗?建议单独发 @uni/util-promisify ,防止单独一个 utils 包后面越来越臃肿。

有的,被引用最多的是

utils/constant
utils/miniappEnvApp
utils/promisify
utils/styleOptions

这几个文件

utils/event 用得不多,只有两个包引用了

现在 utils 是以拷贝的形式放在其他包里,比如 @uni/toast@1.1.0/es/_utils/@uni/loading@1.0.7/es/_utils/,导致 webpack 打包产生了冗余代码

@imsobear
Copy link
Contributor

嗯 根据情况来看,接受微弱的冗余,如果某个 util 代码行数超过 n 并且被引用次数达到 m,那的确建议抽成单独的包减少冗余,这个可以定成规则。

@imsobear
Copy link
Contributor

promisify 我认为是非常有必要的

@imsobear
Copy link
Contributor

@ChrisCindy @DOBEEE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants