Skip to content

Commit 9666ab4

Browse files
author
徐远翔
committed
feat: ios multibundle supporting
1 parent 079955d commit 9666ab4

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

README.md

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
# umi-react-native
22

3-
![](https://img.shields.io/npm/dm/umi-preset-react-native?style=flat-square) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
3+
![](https://img.shields.io/npm/dm/umi-preset-react-native?style=flat-square) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
44

55
使用 [umi@3.x](https://umijs.org/) 加速 [react-native](https://reactnative.dev/) 开发效率:
66

77
- **零配置**,添加[DvaJS](https://dvajs.com/)[@ant-design/react-native](https://rn.mobile.ant.design/index-cn)... 等依赖后开箱即用;
88
- 只需要专注页面 UI 和业务领域模型的实现,所有编译配置,框架运行所需 HOC 和 Context Provider 全部由 umi 搞定;
9-
- 路由方案默认使用 [umi](https://umijs.org/) 内置的[react-router](https://reacttraining.com/react-router/)**可选**[react-navigation](https://reactnavigation.org/)
9+
- 路由方案默认使用 [umi](https://umijs.org/) 内置的[react-router](https://reacttraining.com/react-router/)**可选**[react-navigation](https://reactnavigation.org/)
10+
- 启用[dynamicImport](https://umijs.org/config#dynamicimport)配置后,支持切分多 bundle,运行时从应用本地按需加载 JS bundle 文件。
1011

1112
| NPM 包 | 当前版本 | 简介 |
1213
| --- | --- | --- |
@@ -40,6 +41,14 @@ umi 在 RN 中仅用来生成中间代码(临时文件),介于**编码**
4041

4142
查看示例工程:[UMIHaulExample](https://github.com/xuyuanxiang/UMIHaulExample#readme)
4243

44+
### 切分多 bundle
45+
46+
开发阶段使用:[React Native CLI](https://github.com/react-native-community/cli/blob/master/docs/commands.md#commands)
47+
48+
构建离线包使用:[haul](https://github.com/callstack/haul)拆包。
49+
50+
查看示例工程:[UMIHaulExample#feature/multibundle](https://github.com/xuyuanxiang/UMIHaulExample/tree/feature/multibundle)
51+
4352
## 文档
4453

4554
- [发布日志](/CHANGELOG.md)

packages/umi-react-native-multibundle/ios/Multibundle.m

+1-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ @implementation Multibundle
1717

1818
@try
1919
{
20-
NSURL *url = [[NSBundle mainBundle] URLForResource:bundleName withExtension:@"ios.bundle"];
21-
[bridge registerSegmentWithId:[bundleId unsignedIntegerValue] path:url.absoluteString];
20+
[bridge registerSegmentWithId:[bundleId unsignedIntegerValue] path:[[NSBundle mainBundle] pathForResource:bundleName ofType:@"ios.bundle"]];
2221

2322
resolve(nil);
2423

0 commit comments

Comments
 (0)