Skip to content

Commit 940ddbc

Browse files
authored
docs: re-phrase a note about Hermes engine integration (#72)
* docs: re-phrase a note about Hermes engine integration * docs: explain the difference between lazy format and its interoperability with lazy support in the app
1 parent a1892a2 commit 940ddbc

File tree

2 files changed

+36
-26
lines changed

2 files changed

+36
-26
lines changed

docs/docs/fundamentals/enabling-ram-bundle.md renamed to docs/docs/fundamentals/enabling-lazy-bundle.md

+18-13
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,24 @@
22
sidebar_position: 2
33
---
44

5-
# Enabling Ram Bundle
5+
# Enabling Lazy Bundle
6+
7+
To enable on-demand loading of JavaScript code, you need to activate the lazy bundle feature. In `react-native`, there are two primary types of lazy bundles:
8+
9+
- `RAM` (available only for the **JSC** engine, deprecated in `[email protected]`);
10+
- `mmap` (available only for the **Hermes** engine).
11+
12+
Since `mmap` is enabled by default in **Hermes**, this guide focuses on enabling the `RAM` bundle format.
13+
14+
:::info Important Note for All JS Engines
15+
Enabling the lazy bundle format does not automatically mean your app is fully leveraging the benefits of lazy loading. Simply activating the format does not guarantee optimal performance or resource utilization.
16+
17+
To truly harness the power of lazy loading (such as caching, pre-loading, and other advanced features) you should use this library. For more details, refer to the [basic usage](./basic-usage.md) and [async loading](../guides/async-loading.md) guides.
18+
:::
19+
20+
:::caution Hermes engine apps
21+
This page is focusing only on enabling lazy bundle format for **JSC** engine. If you are using **Hermes** then no extra steps are required (since lazy format is enabled by default) and you can go to the next [basic usage](./basic-usage.md) guide and skip this page.
22+
:::
623

724
## RAM... What is it? About RAM Bundle format
825

@@ -32,14 +49,6 @@ The official way to bundle your React Native apps at the moment is using Metro B
3249

3350
- **File RAM Bundle**: With this approach, every module is stored in a separate file with the name `js-modules/${id}.js`, where `${id}` is the module’s ID. This format is used by default on Android devices but has the same purpose: to have fast access to individual modules in your bundle.
3451

35-
:::caution RAM Bundle deprecation
36-
Starting from `react-native` 0.75 RAM Bundle format has been [deprecated](https://reactnative.dev/blog/2024/08/12/release-0.75#community-cli-removal-of-ram-bundle-and-profile-hermes-commands). The **recommended** approach is to use `Hermes` engine, where lazy loading is enabled by default and no extra-actions are required to enable it.
37-
:::
38-
39-
:::danger Hermes enabled
40-
If you are trying to enable this feature with Hermes engine, you may faced with application crash. It's a known [issue](https://github.com/facebook/react-native/issues/25730). If you are using Hermes then you **don't need** to use RAM format, because Hermes is using lazy loadable [format](https://github.com/facebook/react-native/issues/25730#issuecomment-514115115) by default. **RAM format is actual only for JSC engine.**
41-
:::
42-
4352
## Enabling RAM Bundle feature in your application (JSC only)
4453

4554
For enabling this format in your application you need to do pretty simple steps for each platform.
@@ -48,10 +57,6 @@ For enabling this format in your application you need to do pretty simple steps
4857
Although enabling RAM Bundle format is recommended for both platforms, you can only enable it for one if necessary.
4958
:::
5059

51-
:::info Actual only for JSC
52-
All steps below are actual only for **JSC** engine. If you are using Hermes engine on all platforms then you can go to the [next](./basic-usage.md) section.
53-
:::
54-
5560
### Android
5661

5762
Open `android/app/build.gradle` and edit your file in the following way.

docs/versioned_docs/version-3.x/fundamentals/enabling-ram-bundle.md renamed to docs/versioned_docs/version-3.x/fundamentals/enabling-lazy-bundle.md

+18-13
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,24 @@
22
sidebar_position: 2
33
---
44

5-
# Enabling Ram Bundle
5+
# Enabling Lazy Bundle
6+
7+
To enable on-demand loading of JavaScript code, you need to activate the lazy bundle feature. In `react-native`, there are two primary types of lazy bundles:
8+
9+
- `RAM` (available only for the **JSC** engine, deprecated in `[email protected]`);
10+
- `mmap` (available only for the **Hermes** engine).
11+
12+
Since `mmap` is enabled by default in **Hermes**, this guide focuses on enabling the `RAM` bundle format.
13+
14+
:::info Important Note for All JS Engines
15+
Enabling the lazy bundle format does not automatically mean your app is fully leveraging the benefits of lazy loading. Simply activating the format does not guarantee optimal performance or resource utilization.
16+
17+
To truly harness the power of lazy loading (such as caching, pre-loading, and other advanced features) you should use this library. For more details, refer to the [basic usage](./basic-usage.md) and [async loading](../guides/async-loading.md) guides.
18+
:::
19+
20+
:::caution Hermes engine apps
21+
This page is focusing only on enabling lazy bundle format for **JSC** engine. If you are using **Hermes** then no extra steps are required (since lazy format is enabled by default) and you can go to the next [basic usage](./basic-usage.md) guide and skip this page.
22+
:::
623

724
## RAM... What is it? About RAM Bundle format
825

@@ -32,14 +49,6 @@ The official way to bundle your React Native apps at the moment is using Metro B
3249

3350
- **File RAM Bundle**: With this approach, every module is stored in a separate file with the name `js-modules/${id}.js`, where `${id}` is the module’s ID. This format is used by default on Android devices but has the same purpose: to have fast access to individual modules in your bundle.
3451

35-
:::caution RAM Bundle deprecation
36-
Starting from `react-native` 0.75 RAM Bundle format has been [deprecated](https://reactnative.dev/blog/2024/08/12/release-0.75#community-cli-removal-of-ram-bundle-and-profile-hermes-commands). The **recommended** approach is to use `Hermes` engine, where lazy loading is enabled by default and no extra-actions are required to enable it.
37-
:::
38-
39-
:::danger Hermes enabled
40-
If you are trying to enable this feature with Hermes engine, you may faced with application crash. It's a known [issue](https://github.com/facebook/react-native/issues/25730). If you are using Hermes then you **don't need** to use RAM format, because Hermes is using lazy loadable [format](https://github.com/facebook/react-native/issues/25730#issuecomment-514115115) by default. **RAM format is actual only for JSC engine.**
41-
:::
42-
4352
## Enabling RAM Bundle feature in your application (JSC only)
4453

4554
For enabling this format in your application you need to do pretty simple steps for each platform.
@@ -48,10 +57,6 @@ For enabling this format in your application you need to do pretty simple steps
4857
Although enabling RAM Bundle format is recommended for both platforms, you can only enable it for one if necessary.
4958
:::
5059

51-
:::info Actual only for JSC
52-
All steps below are actual only for **JSC** engine. If you are using Hermes engine on all platforms then you can go to the [next](./basic-usage.md) section.
53-
:::
54-
5560
### Android
5661

5762
Open `android/app/build.gradle` and edit your file in the following way.

0 commit comments

Comments
 (0)