React Native 的 bundle 是什么,它的目的是什么? [英] What is React Native's bundle, and its purpose?

查看:32
本文介绍了React Native 的 bundle 是什么,它的目的是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试了解捆绑包究竟是什么以及它的目的是什么,我可以或不能用它做什么,......

I'm trying to understand what the bundle exactly is and what its purpose is, what I can or can't do with it, ...

我看到当您运行命令 'react-native start' 时,打包程序将被初始化,当您在设备/模拟器上使用 'react-native run-android' 或 '..运行-ios'.在打包器的输出中,您可以看到正在构建的包.您还可以在使用 android 文件夹中的gradle assembleRelease"等 android gradle 命令时看到此包正在构建.

I see that when you run the command 'react-native start' the packager is initialized which will be used when you're running the app on a device/simulator with 'react-native run-android' or '.. run-ios'. In the output of the packager you can see a package being built. You can also see this package being built when using android gradle commands like 'gradle assembleRelease' in the android folder.

我知道它捆绑 javascript 代码.我还看到了一些关于如何使用离线捆绑包"的信息.(这到底是什么意思?)

I know that it bundles the javascript code. I've also seen some info on how to 'use an offline bundle'. (What does that mean exactly?)

感谢您帮助我找到这方面的明确信息,因为我真的很想知道人们为什么会使用离线捆绑包.

I appreciate any help in finding clear information on this, as I would really want to know why people would use an offline bundle for example.

推荐答案

该包确实是javascript".在开发中,bundle 可能来自你的 react-native start 开发服务器.这样,如果您的代码发生更改,服务器将通过 websocket 向客户端发送请求,以下载新代码或动态更新代码.因此,您可以说该包是从您的源代码动态生成的.在生产环境中,您可能希望使用离线包,以便您的代码已在设备上,无需下载.

The bundle is indeed 'the javascript'. In development the bundle likely will come from your react-native start development server. That way if your code is changed the server will send a request to the client, through a websocket, to download the new code or update the code on the fly. So, you could say the bundle is dynamically generated from your source code. In production you probably want to use an offline bundle so that your code is already on the device and does not need to be downloaded.

更多信息:运行设备(http://facebook.github.io/)

这篇关于React Native 的 bundle 是什么,它的目的是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆