Giter Site home page Giter Site logo

Android 生成bundle的hash值似乎和android studio build出来的bundle的hash值不一致, 导致安装的第一次会进行热更新 about code-push-cli HOT 1 OPEN

shm-open avatar shm-open commented on July 22, 2024
Android 生成bundle的hash值似乎和android studio build出来的bundle的hash值不一致, 导致安装的第一次会进行热更新

from code-push-cli.

Comments (1)

JackClown avatar JackClown commented on July 22, 2024 2

记录一下解决过程, 给有需要的同学, react native版本0.73

关于源代码相同情况下code-push-cli生成的bundle与xcode或者android编译生成的bundle不一致

以下code-push-cli特指@shm-open/code-push-cli

  • 启用hermes的时候,生成packager bundle的时候,不需要压缩, 所以code-push-cli需要加上参数--minify false
  • code-push-cli需要根据Podfilehermes_enabled来判断是否开启hermes,但当前版本的react native已经不是根据这个参数来了,需要手动加上
  • android build的时候packager生成的sourcemap名称是index.android.packager.map,因此需要给code-push-cli加上参数--sourcemap-output
  • ios build的时候默认不生成sourcemap,但在不开启sourcemap的情况下hermers编译器生成的bytecode会随着bundle的路径不同而不同,开启sourcemap后,又与bundle的路径无关,真的令人匪夷所思,所以解决方式就是生成sourcemap,做法就是在xcode.env内导出环境变量SOURCEMAP_FILE
export SOURCEMAP_FILE="$DERIVED_FILE_DIR/main.jsbundle.packager.map"

但是xcode编译完后,又会删除sourcemap,而code-push-cli会保留sourcemap并且会上传热更新服务器,这又会触发第一次热更新,调整就是不让code-push-cli上传sourcemap,而且确实没有必要

  • code-push-cli默认会上传CodePush目录下的所有文件, 因为如果我们要生成sourcemap,就不要把sourcemap放在CodePush下面

from code-push-cli.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.