# @gedeagas/react-native-bundle-visualizer 中文文档

规范地址：https://npmcn.com/package/%40gedeagas/react-native-bundle-visualizer/

版本：3\.1\.8
npm 元数据更新时间：2025-08-19T00:41:26.721Z
中文译文更新时间：2026-11-16T01:36:47.552Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40gedeagas/react-native-bundle-visualizer
原文对照：https://npmcn.com/package/%40gedeagas/react-native-bundle-visualizer/?lang=original
项目主页：https://github.com/gedeagas/react-native-bundle-visualizer#readme
源码仓库：https://github.com/gedeagas/react-native-bundle-visualizer

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：17.1 kB，4 个文件
- TypeScript 类型：未声明
- 运行依赖：6 个
- 首次发布：2025-08-07T02:24:07.171Z
- 最新版本发布：2025-08-19T00:41:26.567Z
- 近 30 天下载量：2954（2026-10-16 至 2026-11-14，npm 官方下载统计）
- 已发布版本数：6（近 12 个月 0 个）

## 中文简介

看里面有什么反应

## 安装

```sh
npm install @gedeagas/react-native-bundle-visualizer
```

也可以使用：`pnpm add @gedeagas/react-native-bundle-visualizer`、`yarn add @gedeagas/react-native-bundle-visualizer`、`bun add @gedeagas/react-native-bundle-visualizer`

## README

# @gedegas/反应-本土-捆绑-可视化器

看看你的内在反应

![bundle-visualizer-animation](https://npmcn.com/package/%40gedeagas/react-native-bundle-visualizer/react-native-bundle-visualizer2.gif)

使用赞美 [源图探索器](https://github.com/danvk/source-map-explorer) 以可视化 [大都会捆绑器](https://github.com/facebook/metro)。 。 。 .

## 目的

有时, 导入一个单一的 Javascript 库可以大大地增加你的捆绑大小 。 这个软件包可以帮助您识别这样一个库,这样您就可以保持捆绑大小的低和加载时间快.

## 使用量

确保 [npx 数据](https://github.com/npm/npx) 在工程根中安装并运行以下命令

`npx @gedeagas/react-native-bundle-visualizer`

### 或安装为非依赖性

```sh
yarn add --dev @gedeagas/react-native-bundle-visualizer
```

运行它:

```
yarn run react-native-bundle-visualizer
```

_使用 npm 时 :_

```
npm install --save-dev @gedeagas/react-native-bundle-visualizer
npx react-native-bundle-visualizer
```

## CI/CD 使用量

对于 CI/CD 环境,需要只捕捉到捆绑大小进行比较或监测,请使用 `--bundle-size-only` 选项(输出小数位数为3):

```bash
# Output only the bundle size in megabytes (e.g., "2.450MB")
npx @gedeagas/react-native-bundle-visualizer --bundle-size-only

# Example: Capture bundle size in a variable
BUNDLE_SIZE=$(npx @gedeagas/react-native-bundle-visualizer --bundle-size-only)
echo "Bundle size: $BUNDLE_SIZE"

# Example: Compare bundle sizes in CI
PREV_SIZE=$(cat .bundle-size-cache 2>/dev/null || echo "0MB")
CURRENT_SIZE=$(npx @gedeagas/react-native-bundle-visualizer --bundle-size-only)
echo $CURRENT_SIZE > .bundle-size-cache

# Extract numeric values for comparison (removes "MB" suffix)
PREV_NUM=$(echo $PREV_SIZE | sed 's/MB//')
CURRENT_NUM=$(echo $CURRENT_SIZE | sed 's/MB//')

if (( $(echo "$CURRENT_NUM > $PREV_NUM" | bc -l) )); then
  echo "⚠️  Bundle size increased from $PREV_SIZE to $CURRENT_SIZE"
  exit 1
else
  echo "✅ Bundle size is $CURRENT_SIZE (was $PREV_SIZE)"
fi
```

## 命令行参数

所有命令行参数都是可选的 。 默认情况下,将为 `ios` 平台.

| 选项 | 说明 | 示例 |
| --- | --- | --- |
| `platform` | 要构建的平台( 默认为 **欧斯**(中文(简体) ) | `--platform ios` |
| `dev` | 开发或生产构建( 默认为 **虚假**(中文(简体) ) | `--dev false` |
| `entry-file` | 条目文件( 当省略试图自动解析时) | `--entry-file ./index.ios.js` |
| `bundle-output` | 输出捆绑文件( 默认为 **tmp 调制**(中文(简体) ) | `--bundle-output ./myapp.bundle` |
| `format` | 输出格式 **(简体中文)**, (中文(简体) ), **乔森** 或者说 **tsv 数据** (默认为 **(简体中文)**) (见 [源图探索选项](https://github.com/danvk/source-map-explorer#options)(中文(简体) ) | `--format json` |
| `only-mapped` | 从输出中排除“ 未映射” 字节( 默认为 **虚假**) (中文(简体) ). 这将导致总数低于文件大小 . | `--only-mapped` |
| `verbose` | 向控制台倾倒额外输出( 默认为 **虚假**(中文(简体) ) | `--verbose` |
| `reset-cache` | 删除已缓存的反应内在文件( 默认为 **虚假**(中文(简体) ) | `--reset-cache` |
| `--expo` | 根据是否使用 expo 设定为真/ 假 。 对于eg, 设置 `--expo true` 当使用博览会。 无需通过此反应- 亲和 Cli 。 (默认为 **虚假**(中文(简体) ) | `--expo false` |
| `--no-border-checks` | 把同一面旗子传到下面 `source-map-explorer` 以禁用无效的映射列/行检查. | `--no-border-checks` |
| `--bundle-size-only` | 只输出有"MB"后缀的平方兆字节的捆绑大小(3个小数位,如"2.450MB")(对CI/CD环境有用). 这将压制所有其他输出, 只返回格式大小 . | `--bundle-size-only` |

> 使用 [反应- 内置- 捆绑- 视觉器@ 2](https://github.com/IjzerenHein/react-native-bundle-visualizer/tree/v2) 当瞄准 Expo SDK 40或更低.

## 版本兼容性

| 版本 | 评论 |
| --- | --- |
| 3.x 运算 | 兼容 React-Native CLI 靴子化项目和博览会SDK 41或更高. |
| [2.x 数据](https://github.com/IjzerenHein/react-native-bundle-visualizer/tree/v2) | 兼容 React-Native CLI roottraped projects 和 Expo SDK 40 或更早. |
| [1.x 运算](https://github.com/IjzerenHein/react-native-bundle-visualizer/tree/v1) | 使用 [散装弹炮](https://github.com/callstack/haul) 而不是地铁的输出. |

## 许可证

[麻省理工学院](https://npmcn.com/package/%40gedeagas/react-native-bundle-visualizer/LICENSE.txt)

## 常见问题

### @gedeagas/react-native-bundle-visualizer 是什么？

看里面有什么反应

### 如何安装 @gedeagas/react-native-bundle-visualizer？

在项目目录运行 npm install @gedeagas/react-native-bundle-visualizer，或使用 pnpm add / yarn add / bun add。它还提供命令行工具 react-native-bundle-visualizer，可以用 npx react-native-bundle-visualizer 直接运行。

### @gedeagas/react-native-bundle-visualizer 支持 TypeScript 吗？

该包的 package\.json 没有声明类型入口。需要类型提示时，可以在 npm 上查找社区维护的 @types/gedeagas\_\_react-native-bundle-visualizer 是否存在。

### @gedeagas/react-native-bundle-visualizer 可以商用吗？

@gedeagas/react-native-bundle-visualizer 使用 MIT 许可。宽松许可：允许商业使用、修改和再分发，通常只需在分发时保留原版权与许可声明。以上为概括，不构成法律意见，请以许可原文为准。

### @gedeagas/react-native-bundle-visualizer 的下载量有多少？

根据 npm 官方下载统计，@gedeagas/react-native-bundle-visualizer 在 2026/10/16 – 2026/11/14 这 30 天内被下载 2,954 次，日均约 98 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### @gedeagas/react-native-bundle-visualizer 还在维护吗？

最新版本 3\.1\.8 发布于 2025/08/19（1\.2 年前）；至今共发布 6 个版本，其中过去 12 个月发布了 0 个；首次发布于 2025/08/07。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

