UNPKG

2.06 kBMarkdownView Raw
1# React Native Bundle Splitter
2
3Split config: [splitconfig](./split-example/.splitconfig).
4
5## Why just an EXAMPLE (not a complete library)
6
7RN Bundle split is not just "split", it should also take two point into consideration:
8
9- **How to use them**, means native code framework change, because RN native part not support loading script in demand.
10- **Project structure**, you should have a clean project dependency graph (recursive dependency is bad).
11
12So, I don't want to make it to a library which be common to use.
13
14In this example, it have clear project structure and some hack to RN framework (by reflection in Java). All split-bundle related code is in **src** directory, use them with pleasure:)
15
16## Project Structure
17
18```
19/root
20 |- /src
21 |- /components
22 |- /packagea
23 |- SampleA.js => Entry1
24 |- ApiOfSampleA.js => Refered in SampleA.js
25 |- /packageb
26 |- SampleB => Entry2
27 |- ApiOfSampleA.js => Refered in SampleA.js
28 |- /modules
29 |- index.js => Append to base
30 |- ModuleA.js => Refered in index.js
31 |- ModuleB.js => Refered in index.js
32 |- base.js => Entry of base
33 |- resolveInject.js => Resolve splitted resource
34```
35
36## Usage
37
38```
39npm install
40node ../index.js --platform android --output build --config .splitconfig --dev false
41```
42See example [run-example.sh](./split-example/run-example.sh).
43
44## Run Example
45
46```
47cd split-example
48npm install
49./run-example.sh
50```
51
52## License
53
54```
55 Copyright 2015 Desmond Yao
56
57 Licensed under the Apache License, Version 2.0 (the "License");
58 you may not use this file except in compliance with the License.
59 You may obtain a copy of the License at
60
61 http://www.apache.org/licenses/LICENSE-2.0
62
63 Unless required by applicable law or agreed to in writing, software
64 distributed under the License is distributed on an "AS IS" BASIS,
65 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
66 See the License for the specific language governing permissions and
67 limitations under the License.
68```
69
70