react-native-bundle-discovery-ui 2.1.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -18
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,13 +3,11 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/react-native-bundle-discovery)
|
|
4
4
|
[](https://www.npmtrends.com/react-native-bundle-discovery)
|
|
5
5
|
|
|
6
|
-
|
|
7
6
|
A simple package that helps developers visualize and analyze the bundle size of React Native apps.
|
|
8
7
|
With this tool, you can easily explore your app's codebase, identify large or heavy packages, and inspect the structure of modules and code within your project.
|
|
9
8
|
|
|
10
9
|
<img width="800" alt="" src="./assets/img.png" />
|
|
11
10
|
|
|
12
|
-
|
|
13
11
|
### Packages:
|
|
14
12
|
|
|
15
13
|
- `react-native-bundle-discovery` - simple JS library to generate a JSON report of the bundle.
|
|
@@ -21,7 +19,7 @@ With this tool, you can easily explore your app's codebase, identify large or he
|
|
|
21
19
|
|
|
22
20
|
There are two ways to install the package:
|
|
23
21
|
|
|
24
|
-
1. As in independent tool (UI + CLI)
|
|
22
|
+
1. As in independent tool (UI + CLI)
|
|
25
23
|
2. Or as a [Rozenite](_rozenite/README.md) plugin (see: [_rozenite/README.md](_rozenite/README.md))
|
|
26
24
|
|
|
27
25
|
#### 1. Install (independent tool)
|
|
@@ -112,30 +110,34 @@ npx react-native-bundle-discovery-ui build metro-stats.json
|
|
|
112
110
|
| outputJsonPath: string | `<root>/metro-stats.json` | The path where the JSON report will be saved. Defaults to `metro-stats.json` in project root. |
|
|
113
111
|
| includeCode: boolean | `true` | Whether to include the source and output code in the JSON report. |
|
|
114
112
|
|
|
115
|
-
|
|
113
|
+
**⚠️ Be cautious sharing reports with `includeCode` enabled**
|
|
114
|
+
|
|
115
|
+
Enabling this option significantly increases report size and **embeds the source code** of your assets.
|
|
116
116
|
|
|
117
|
+
If your code is proprietary 🔒, share these reports responsibly 🤝!
|
|
118
|
+
|
|
119
|
+
---
|
|
117
120
|
|
|
118
|
-
|
|
119
|
-
| ---------------------- | ------------------------- | ----------------------------- |
|
|
120
|
-
| removePromisePolyfill: boolean | `false` | Remove the Promise polyfill as Hermes provide own impl. (issue: [#57702](https://github.com/react/react-native/issues/57702)) |
|
|
121
|
-
| removeOldRenderer: boolean | `false` | Whether to remove the old renderer. Set to `true` when New Arch is enabled |
|
|
122
|
-
| removeNewRenderer: boolean | `false` | Whether to remove the new renderer. Set to `true` when New Arch is disabled |
|
|
123
|
-
| removeUTFSequence: boolean | `false` | Remove useless undocumented RN module. |
|
|
121
|
+
### `createResolveRequest(options: ResolveRequestOptions)`
|
|
124
122
|
|
|
123
|
+
| Prop | Default value | Description |
|
|
124
|
+
| ------------------------------ | ------------- | ----------------------------------------------------------------------------------------------------------------------------- |
|
|
125
|
+
| removePromisePolyfill: boolean | `false` | Remove the Promise polyfill as Hermes provide own impl. (issue: [#57702](https://github.com/react/react-native/issues/57702)) |
|
|
126
|
+
| removeUTFSequence: boolean | `false` | Remove useless undocumented RN module. |
|
|
125
127
|
|
|
126
|
-
|
|
128
|
+
Helper that creates a custom resolve request function to filter out unnecessary modules from the bundle.
|
|
127
129
|
You can get recommendations during the analysis of the bundle report using the CLI tool.
|
|
128
130
|
|
|
129
131
|
```js
|
|
130
132
|
// metro.config.js
|
|
131
|
-
const {
|
|
133
|
+
const { createResolveRequest } = require("react-native-bundle-discovery");
|
|
134
|
+
const resolveRequest = createResolveRequest({
|
|
135
|
+
removePromisePolyfill: true,
|
|
136
|
+
removeUTFSequence: true,
|
|
137
|
+
});
|
|
132
138
|
const config = {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
removePromisePolyfill: true,
|
|
136
|
-
removeOldRenderer: true,
|
|
137
|
-
removeUTFSequence: true,
|
|
138
|
-
}),
|
|
139
|
+
resolver: {
|
|
140
|
+
resolveRequest,
|
|
139
141
|
},
|
|
140
142
|
};
|
|
141
143
|
```
|