> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.

# bundle

`bundle` or `webpack-bundle` is a command-line tool that builds the bundle for the provided project.

## Usage

In the root of an existing project, run this command in your terminal of choice:


```sh [npm]
npm run react-native bundle
```

```sh [yarn]
yarn react-native bundle
```

```sh [pnpm]
pnpm react-native bundle
```

```sh [bun]
bun react-native bundle
```

## Options

:::info

To stay compatible with the `@react-native-community/cli` command, the following flags are included but are not functional:

- `--config-cmd`

:::

### `--entry-file`

- Type: `string`

Path to the root JS file, either absolute or relative to JS root.

### `--platform`

- Type: `string`
- Default: `"ios"`

Either "ios" or "android".

### `--dev`

- Type: `boolean`
- Default: `true`

Enables development warnings and disables production optimizations.

### `--minify`

- Type: `boolean`

Allows overriding whether bundle is minified. This defaults to false if dev is true, and true if dev is false. Disabling minification can be useful for speeding up production builds for testing purposes.

### `--bundle-output`

- Type: `string`

File name where to store the resulting bundle, ex. /tmp/groups.bundle.

### `--sourcemap-output`

- Type: `string`

File name where to store the sourcemap file for resulting bundle, ex. /tmp/groups.map.

### `--assets-dest`

- Type: `string`

Directory name where to store assets referenced in the bundle.

### `--json`

- Type: `string`

Stores stats in a file.

### `--stats`

- Type: `string`

Instructs Rspack on how to treat the stats. Use with `--json` to store stats in a file.

- `'errors-only'` - only output when errors happen
- `'errors-warnings'` - only output errors and warnings happen
- `'minimal'` - only output when errors or new compilation happen
- `'none'` - output nothing
- `'normal'` - standard output
- `'verbose'` - output everything
- `'detailed'` - output everything except chunkModules and chunkRootModules
- `'summary'` - output webpack version, warnings count and errors count

Example:


```sh [npm]
npm run react-native bundle --stats summary --json ./stats.json
```

```sh [yarn]
yarn react-native bundle --stats summary --json ./stats.json
```

```sh [pnpm]
pnpm react-native bundle --stats summary --json ./stats.json
```

```sh [bun]
bun react-native bundle --stats summary --json ./stats.json
```

More details: [Rspack documentation](https://rspack.rs/config/stats)

### `--reset-cache`

- Type: `boolean`

Resets the transformation cache.

### `--verbose`

- Type: `boolean`

Enables verbose logging.

### `--watch`

- Type: `boolean`
- Default: `false`

Watch for file changes.

### `--max-workers`

- Type: `number`

(Rspack only) The maximum number of workers to use for transformation parallelization. By default, the number of workers is derived from available CPU cores.

### `--config`

- Type: `string`

Path to a bundler config file, e.g rspack.config.js.

### `--bundler`

- Type: `"rspack" | "webpack"`

Select the bundler explicitly. Without this option, Re.Pack infers the bundler from the `--config` filename, then checks the standard Rspack and webpack config filenames, and defaults to Rspack.

### `--webpackConfig`

- Type: `string`
- Deprecated: Use [`--config`](#--config) instead

Path to a bundler config file, e.g webpack.config.js.

### `-h`, `--help`

Display help for command.
