@@ -18,13 +18,18 @@ With this tool, you can easily explore your app's codebase, identify large or he
1818
1919### Setup:
2020
21- #### 1. Install
21+ There are two ways to install the package:
22+
23+ 1 . As in independent tool
24+ 2 . Or as a [ Rozenite] ( https://www.rozenite.dev/ ) plugin (see below).
25+
26+ #### 1. Install (independent tool)
2227
2328``` bash
2429yarn add -D react-native-bundle-discovery
2530```
2631
27- #### 2. Add to your metro.config.js
32+ Add to your ` metro.config.js ` :
2833
2934``` diff
3035// metro.config.js
@@ -48,6 +53,46 @@ const {getDefaultConfig, mergeConfig} = require('@react-native/metro-config');
4853module.exports = mergeConfig(getDefaultConfig(__dirname), config);
4954```
5055
56+ ---
57+
58+ #### 2. Install as a Rozenite plugin (OPTIONAL)
59+
60+
61+ ``` bash
62+ yarn dlx rozenite@latest init # init rozenite in your project (from: https://www.rozenite.dev/docs/getting-started)
63+ yarn add -D react-native-bundle-discovery-rozenite-plugin # add the plugin to your project
64+ ```
65+
66+ Then in the ` metro.config.js ` file add the following:
67+
68+ ``` diff
69+ const { withRozenite } = require('@rozenite/metro');
70+ + const { withRozeniteBundleDiscoveryPlugin } = require('react-native-bundle-discovery-rozenite-plugin');
71+ const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');
72+
73+ /**
74+ * Metro configuration
75+ * https://reactnative.dev/docs/metro
76+ *
77+ * @type {import('@react-native/metro-config').MetroConfig}
78+ */
79+ const config = {};
80+
81+ module.exports = withRozenite(
82+ mergeConfig(getDefaultConfig(__dirname), config),
83+ {
84+ + enhanceMetroConfig: config => withRozeniteBundleDiscoveryPlugin(config, { /* Your Bundle Discovery Options */ }),
85+ enabled: true,
86+ },
87+ );
88+ ```
89+
90+ Now you can run ` yarn start ` and open [ React Native DevTools] ( https://reactnative.dev/docs/react-native-devtools )
91+
92+
93+ ---
94+
95+
5196#### 3. Build the app
5297
5398As example, for iOS you can run the following command, and it will generate the ` metro-stats.json ` file in the root of your project:
0 commit comments