Skip to content

Commit 35d0707

Browse files
author
徐远翔
committed
feat: dev-rn done
1 parent fbf5c13 commit 35d0707

33 files changed

+627
-669
lines changed

README.md

+4-55
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,10 @@
22

33
[umi](https://umijs.org/) preset plugins for react-native.
44

5-
> 👷 正在施工...
6-
7-
- [x] umi-preset-react-native:react-native 插件集,**必需**
8-
- [x] umi-plugin-react-native-bundler-haul:第三方 [haul](https://github.com/callstack/haul) 打包器,与 metro 只能**二选一**
9-
- [ ] umi-plugin-react-native-bundler-metro:RN 官方 [metro](https://facebook.github.io/metro/) 打包器,与 haul 只能**二选一**
10-
115
## 目录
126

137
- [必备](#%E5%BF%85%E5%A4%87)
148
- [安装](#%E5%AE%89%E8%A3%85)
15-
- [安装 react-native 预设插件集](#%E5%AE%89%E8%A3%85-react-native-%E9%A2%84%E8%AE%BE%E6%8F%92%E4%BB%B6%E9%9B%86)
16-
- [安装 react-native 打包器](#%E5%AE%89%E8%A3%85-react-native-%E6%89%93%E5%8C%85%E5%99%A8)
17-
- [选用官方 metro 打包](#%E9%80%89%E7%94%A8%E5%AE%98%E6%96%B9-metro-%E6%89%93%E5%8C%85)
18-
- [选用第三方 haul 打包](#%E9%80%89%E7%94%A8%E7%AC%AC%E4%B8%89%E6%96%B9-haul-%E6%89%93%E5%8C%85)
199
- [使用](#%E4%BD%BF%E7%94%A8)
2010
- [配置 umi](#%E9%85%8D%E7%BD%AE-umi)
2111
- [开发](#%E5%BC%80%E5%8F%91)
@@ -28,61 +18,24 @@
2818

2919
## 安装
3020

31-
### 安装 react-native 预设插件集
32-
3321
在 RN 工程内部安装:
3422

3523
```npm
3624
yarn add umi-preset-react-native --dev
3725
```
3826

39-
### 安装 react-native 打包器
40-
41-
**二选一,同时安装会导致 umi 报错(`dev``build`命令行工具冲突)。**
42-
43-
#### 选用官方 metro 打包
44-
45-
在 RN 工程内部安装:
46-
47-
```npm
48-
yarn add umi-plugin-react-native-bundler-metro --dev
49-
```
50-
51-
**注意:**
52-
53-
```json
54-
{
55-
"name": "umi-plugin-react-native-bundler-metro",
56-
"engines": {
57-
"node": ">=8.3"
58-
},
59-
"peerDependencies": {
60-
"metro": "^0.58.0",
61-
"react": "^16.11.0",
62-
"react-native": ">=0.62.0-rc.0 <1.0.x"
63-
}
64-
}
65-
```
66-
67-
#### 选用第三方 haul 打包
68-
69-
在 RN 工程内部安装:
70-
71-
```npm
72-
yarn add umi-plugin-react-native-bundler-haul --dev
73-
```
74-
75-
**注意:**
27+
**注意:** 以下是`umi-preset-react-native`对 Node、react、react-native、umi 版本的要求:
7628

7729
```json
7830
{
79-
"name": "umi-plugin-react-native-bundler-haul",
31+
"name": "umi-preset-react-native",
8032
"engines": {
8133
"node": ">=10.x"
8234
},
8335
"peerDependencies": {
8436
"react": "^16.8.3",
85-
"react-native": ">=0.59.0 <1.0.x"
37+
"react-native": ">=0.59.0 <1.0.x",
38+
"umi": "^3.0.0"
8639
}
8740
}
8841
```
@@ -97,16 +50,12 @@ export default {
9750
history: {
9851
type: 'memory',
9952
},
100-
// dynamicImport: {
101-
// loading: 'components/MyLoading.js'
102-
// },
10353
};
10454
```
10555

10656
**注意:**
10757

10858
- `history`配置项:在 RN 中只能使用:`'memory'`类型,[umi](https://umijs.org/) 默认值是:`'browser'``'browser'``'hash'`类型都需要 DOM,在 RN 中会报错;
109-
- `dynamicImport`配置项:如果打算启用该功能,则必须实现一个自定义的 Loading 组件,且将组件的**相对路径**配置到这里覆盖默认值,[umi](https://umijs.org/) 默认 loading 使用了 HTML 的`<p></p>`标签,在 RN 中会报错。
11059

11160
**在 RN 中集成其他[umi](https://umijs.org/)插件需要开发者自行斟酌。**
11261

packages/bundler-haul/src/asyncClean.ts

-34
This file was deleted.

packages/bundler-haul/src/babelConfigTpl.ts

-6
This file was deleted.

packages/bundler-haul/src/generateFiles.ts

-65
This file was deleted.

packages/bundler-haul/src/haulConfigTpl.ts

-19
This file was deleted.

packages/bundler-haul/src/index.ts

-150
This file was deleted.

0 commit comments

Comments
 (0)