收藏
回答

Ask about code-package-size?

can you guys give me some tips on how to decrease code package size?

any tip and trick or hack

limit is only 20MB, i think my app will be quite big

回答关注问题邀请回答
收藏

3 个回答

  • 郑钱花
    郑钱花
    2天前

    从简单到复杂

    1.删除无效的静态资源,使用TinyPng压缩静态资源

    2.代码分包,tabbar的页面作为主包,tabbar对应的页面以及关联的二级页面作为一个分包,比如5个tabbar页面,就做5个分包

    3.分包之后静态资源也随着分包,要注意区分,只有分包里用到的资源才转移到分包,分包共用的图片只能放主包。

    4.图片按大小排序,上传至服务器后使用https链接替换,然后删除本地图片资源

    5.减少使用一些非必要的三方npm包,手写方法替换实现


    You can translate it yourself

    2天前
    有用
    回复 1
    • Andres99
      Andres99
      2天前
      Thank you very much
      But can u give me code example about 
      3. After subpackaging, static resources are also subpacked. Please pay attention to the distinction. Only the resources used in the subpackaging are transferred to the subpackaging, and the images shared by the subpackaging can only be placed in the main package.
      2天前
      回复
  • 智能回答 智能回答 本次回答由AI生成
    星期四 17:05
    有用
  • Chlity
    Chlity
    星期四 17:05

    where are you from?

    星期四 17:05
    有用
    回复 2
    • Andres99
      Andres99
      星期四 17:08
      From Vietnam
      星期四 17:08
      回复
    • Chlity
      Chlity
      星期四 17:11回复Andres99
      unbelievable,This is China, please send Chinese
      星期四 17:11
      回复
登录 后发表内容