@convex-dev/bundle-analyzer

中文文档
0.1.0发布于 2026/10/20Apache-2.0ES Module近 30 天下载 3848

Analyze your Convex project to identify ways to optimize your bundle size.

原始使用文档
文档目录11 节
  1. Commands
  2. summary
  3. insights
  4. components
  5. packages
  6. files
  7. modules
  8. explore
  9. JSON output
  10. Requirements
  11. Version matching

@convex-dev/bundle-analyzer

[!NOTE] This package is in alpha. Commands and output shapes may change between releases.

Analyze your Convex project to identify ways to optimize your bundle size.

Run the analyzer from the root directory of your project:

npx @convex-dev/bundle-analyzer summary

Commands

Start with summary or insights, then drill into whatever stands out with packages, files, or modules.

summary

An overview of your bundle: its total size, the top insights, and its largest components, packages and modules.

npx @convex-dev/bundle-analyzer summary

insights

Suggestions for making your bundle smaller.

npx @convex-dev/bundle-analyzer insights

components

The size of each component's bundle for each runtime. Use it to see which component to look at first.

npx @convex-dev/bundle-analyzer components

packages

The largest npm packages across your bundles. Pass a package to see which of your entry points import it.

npx @convex-dev/bundle-analyzer packages
npx @convex-dev/bundle-analyzer packages zod

files

The largest individual files across your bundles. Pass a file path, or part of one, such as [email protected]/ for a package's files, to see which modules it's bundled into and what imports it.

npx @convex-dev/bundle-analyzer files
npx @convex-dev/bundle-analyzer files convex/lib/

modules

How much code the runtime loads to run a function in each module: the module and the shared chunks it imports. Pass a module or chunk to see the files in it, what it imports, and which modules import it.

npx @convex-dev/bundle-analyzer modules
npx @convex-dev/bundle-analyzer modules convex/messages.ts

explore

Browse your bundle in an interactive treemap in the terminal. Total size includes code, source maps, and external packages estimated from your local node_modules, matching summary.

npx @convex-dev/bundle-analyzer explore

Run any command with --help to see its options. --limit sets how many rows each list shows. In files and packages details, it also limits entry points per copy. Those commands default to 30 list entries and 3 import chains per copy.

JSON output

Every command except explore takes --json to print JSON to stdout instead of a report, for scripts and AI agents. Insights expose savedCodeBytes and savedSourceMapBytes; savedBytes is their combined estimated saving.

npx @convex-dev/bundle-analyzer packages zod --json

Requirements

  • convex/_generated/ must already exist. Run npx convex dev --once or npx convex codegen first. The analyzer doesn't generate code.
  • The project's dependencies must be installed, since bundling resolves its imports from node_modules.

Version matching

The analyzer will warn if the project's convex version differs from the analyzer's version of convex. There may be slight differences in the way the bundler behaves in different convex versions. A planned future feature is to support analyzing an existing bundle, independent of convex version.

版本与发布记录

@convex-dev/bundle-analyzer 共发布 4 个版本,首次发布于 2026/10/17;过去 12 个月发布了 4 个版本。

版本发布日期距今
0.1.0latest2026/10/2021 天前
0.0.1-alpha.1alpha2026/10/1724 天前
0.0.1-alpha.02026/10/1725 天前
0.0.0-stage2026/10/1725 天前

关于 @convex-dev/bundle-analyzer 的常见问题

@convex-dev/bundle-analyzer 是什么?

Analyze your Convex project to identify ways to optimize your bundle size.

如何安装 @convex-dev/bundle-analyzer?

在项目目录运行 npm install @convex-dev/bundle-analyzer,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 bundle-analyzer,可以用 npx bundle-analyzer 直接运行。

@convex-dev/bundle-analyzer 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/convex-dev__bundle-analyzer 是否存在。

@convex-dev/bundle-analyzer 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@convex-dev/bundle-analyzer 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@convex-dev/bundle-analyzer 可以商用吗?

@convex-dev/bundle-analyzer 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@convex-dev/bundle-analyzer 的下载量有多少?

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

@convex-dev/bundle-analyzer 还在维护吗?

最新版本 0.1.0 发布于 2026/10/20(21 天前);至今共发布 4 个版本,其中过去 12 个月发布了 4 个;首次发布于 2026/10/17。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。