react-native-bundle-discovery 2.0.0-rc.2 → 2.0.0-rc.3
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 +2 -44
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,22 +10,13 @@ With this tool, you can easily explore your app's codebase, identify large or he
|
|
|
10
10
|
<img width="800" alt="" src="./assets/img.png" />
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
### What you should consider when analyzing your bundle
|
|
14
|
-
|
|
15
|
-
1. if you use **React 19** then it's time to remove a `prop-types` package from your bundle.
|
|
16
|
-
2. Search for `development|debug|dev|storybook` modules in your production JS bundle (it's a dead code that should not be there).
|
|
17
|
-
3. Also check polyfills duplicates (search example: `url|fetch|crypto|buffer|base-?64`).
|
|
18
|
-
4. Verify that you don't have any similar packages in your bundle (search example: `object|just-|debounce|ramda|lodash|underscore`). I often see that devs use both `lodash/debounce`, `lodash.debounce` and `debounce` in their projects. Or mix `ramda`, `underscore` and `lodash`._
|
|
19
|
-
5. Try to find `package.json$` files in your bundle. They are often used to get only the package `version/name` but all other fields are not needed in the bundle.
|
|
20
|
-
6. Please provide your ideas soo other devs can benefit from them :)
|
|
21
|
-
|
|
22
13
|
|
|
23
14
|
### Setup:
|
|
24
15
|
|
|
25
16
|
There are two ways to install the package:
|
|
26
17
|
|
|
27
|
-
1. As in independent tool
|
|
28
|
-
2. Or as a [Rozenite](https://www.rozenite.dev/) plugin
|
|
18
|
+
1. As in independent tool (UI + CLI)
|
|
19
|
+
2. Or as a [Rozenite](https://www.rozenite.dev/) plugin
|
|
29
20
|
|
|
30
21
|
#### 1. Install (independent tool)
|
|
31
22
|
|
|
@@ -59,39 +50,6 @@ module.exports = mergeConfig(getDefaultConfig(__dirname), config);
|
|
|
59
50
|
|
|
60
51
|
---
|
|
61
52
|
|
|
62
|
-
#### 2. Install as a Rozenite plugin (OPTIONAL)
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
```bash
|
|
66
|
-
yarn dlx rozenite@latest init # init rozenite in your project (from: https://www.rozenite.dev/docs/getting-started)
|
|
67
|
-
yarn add -D react-native-bundle-discovery-rozenite-plugin # add the plugin to your project
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
Then in the `metro.config.js` file add the following:
|
|
71
|
-
|
|
72
|
-
```diff
|
|
73
|
-
const { withRozenite } = require('@rozenite/metro');
|
|
74
|
-
+const { withRozeniteBundleDiscoveryPlugin } = require('react-native-bundle-discovery-rozenite-plugin');
|
|
75
|
-
const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Metro configuration
|
|
79
|
-
* https://reactnative.dev/docs/metro
|
|
80
|
-
*
|
|
81
|
-
* @type {import('@react-native/metro-config').MetroConfig}
|
|
82
|
-
*/
|
|
83
|
-
const config = {};
|
|
84
|
-
|
|
85
|
-
module.exports = withRozenite(
|
|
86
|
-
mergeConfig(getDefaultConfig(__dirname), config),
|
|
87
|
-
{
|
|
88
|
-
+ enhanceMetroConfig: config => withRozeniteBundleDiscoveryPlugin(config, { /* Your Bundle Discovery Options */ }),
|
|
89
|
-
enabled: true,
|
|
90
|
-
},
|
|
91
|
-
);
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
Now you can run `yarn start` and open [React Native DevTools](https://reactnative.dev/docs/react-native-devtools)
|
|
95
53
|
|
|
96
54
|
|
|
97
55
|
---
|
package/package.json
CHANGED