ReactNative代碼拆分文檔
目的
-
優(yōu)化現(xiàn)有程序的包下載邏輯柳琢,優(yōu)化70%以上
總共2M優(yōu)化到100K以內(nèi)
react native程序秒開瓮床,優(yōu)化白屏顯示
思路
替換自增方式增加關(guān)聯(lián)见妒,改用字符串引用。項(xiàng)目中增加空白首頁進(jìn)行預(yù)加載浸船。
方法
- 自定義metro-bundle
- 自定義metro-bundler-cli
- 增加框架sm-react-native-templates
工具文檔地址:
@caiwenshu/metro-bundler (https://github.com/caiwenshu/metro/tree/0.20.x)
sm-metro-bundler-cli (https://github.com/caiwenshu/sm-metro-bundler-cli)
sm-react-native-templates (https://github.com/caiwenshu/sm-react-native-templates
開發(fā)方式
sm-metro-bundler-cli介紹
React Native模板介紹
原生集成
注: RN1 - RN5為單獨(dú)的模塊