React Native 之 main.jsbundle生成方法

1,202 阅读1分钟
原文链接: blog.csdn.net

坚持 成长 每日一篇

步骤:

1.在React Native项目根目录下运行 npm start

2.使用curl命令生成 main.jsbundle

curl http://localhost:8081/index.ios.bundle -o main.jsbundle

3.在AppDelegate.m中选择使用main.jsbundle 注释掉

  jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"];

取消注释下面这一行

  // jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];