# @codecov/remix-vite-plugin 中文文档

规范地址：https://npmcn.com/package/%40codecov/remix-vite-plugin/

版本：2\.0\.1
npm 元数据更新时间：2026-05-28T20:13:32.113Z
中文译文更新时间：2026-11-10T06:33:24.465Z
软件包许可：MIT

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

原始 npm 页面：https://www.npmjs.com/package/%40codecov/remix-vite-plugin
原文对照：https://npmcn.com/package/%40codecov/remix-vite-plugin/?lang=original

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

- 包体积（解压后）：32.4 kB，10 个文件
- 模块格式：ESM + CJS
- TypeScript 类型：包内自带
- Node.js 要求：\>=20\.0\.0
- 运行依赖：3 个
- peer 依赖：remix 2\.x
- 首次发布：2024-06-18T10:53:25.622Z
- 最新版本发布：2026-04-15T14:22:14.517Z
- 近 30 天下载量：3494（2026-10-10 至 2026-11-08，npm 官方下载统计）
- 已发布版本数：19（近 12 个月 2 个）

## 中文简介

正式的 Codecov Remix 插件

## 安装

```sh
npm install @codecov/remix-vite-plugin
```

也可以使用：`pnpm add @codecov/remix-vite-plugin`、`yarn add @codecov/remix-vite-plugin`、`bun add @codecov/remix-vite-plugin`

## README

[![Codecov by Sentry logo](https://about.codecov.io/wp-content/themes/codecov/assets/brand/sentry-cobranding/logos/codecov-by-sentry-logo.svg)](https://about.codecov.io/)

# 编码重混插件

一个为Codecov提供捆绑分析支持的Remix插件.

> \[注\] 此插件仅在与 Vite 相建时支持 Remix 2. x .
> 
> 插件不支持代码覆盖, 请见 our [文档](https://docs.codecov.com/docs/quick-start) 今天就开始报道!

## 安装

使用 npm :

```bash
npm install @codecov/remix-vite-plugin --save-dev
```

使用线条 :

```bash
yarn add @codecov/remix-vite-plugin --dev
```

使用 pnpm :

```bash
pnpm add @codecov/remix-vite-plugin --save-dev
```

## 公共 Repo 示例 - GitHub 动作

此配置将自动将捆绑分析上传到 Codecov 用于公共寄存器. 当内部的 PR 创建时, 它会使用在您的秘密中设置的 Codecov 令牌, 如果运行从一个被预留的 PR 中, 它会自动使用无令牌设置 。 对于不使用 GitHub 动作的设置,请参见以下 [实例](https://npmcn.com/package/%40codecov/remix-vite-plugin/#readme-public-repo-example---non-github-actions)。关于私人储存库,请参见: [实例](https://npmcn.com/package/%40codecov/remix-vite-plugin/#readme-private-repo-example)。 。 。 .

```ts
// vite.config.ts
import { vitePlugin as remix } from "@remix-run/dev";
import { defineConfig } from "vite";
import tsconfigPaths from "vite-tsconfig-paths";
import { codecovRemixPlugin } from "@codecov/remix-vite-plugin";

export default defineConfig({
  plugins: [
    remix(),
    tsconfigPaths()
    // Put the Codecov Remix plugin after all other plugins
    codecovRemixPlugin({
      enableBundleAnalysis: true,
      bundleName: "example-remix-bundle",
      uploadToken: process.env.CODECOV_TOKEN,
      gitService: "github",
    }),
  ],
});
```

## 公共 Repo 示例 - 非 GitHub 动作

此设置适用于没有使用 GitHub 动作的公有寄存器, 此配置将自动上传捆绑分析到 Codecov 。 您需要配置类似于 GitHub 动作示例的功能, 然而您需要提供分支覆盖, 并确保它能通过正确的分支名称, 并使用包括分叉所有者在内的分叉 . `fork-owner:branch`。 。 。 .

```ts
// vite.config.ts
import { vitePlugin as remix } from "@remix-run/dev";
import { defineConfig } from "vite";
import tsconfigPaths from "vite-tsconfig-paths";
import { codecovRemixPlugin } from "@codecov/remix-vite-plugin";

export default defineConfig({
  plugins: [
    remix(),
    tsconfigPaths()
    // Put the Codecov Remix plugin after all other plugins
    codecovRemixPlugin({
      enableBundleAnalysis: true,
      bundleName: "example-remix-bundle",
      uploadToken: process.env.CODECOV_TOKEN,
      gitService: "github",
      uploadOverrides: {
        branch: "<branch value>",
      },
    }),
  ],
});
```

## 私人 Repo 示例

这是私人寄存器使用插件的必要方式 。 此配置将自动上传捆绑分析到 Codecov.

```ts
// vite.config.ts
import { vitePlugin as remix } from "@remix-run/dev";
import { defineConfig } from "vite";
import tsconfigPaths from "vite-tsconfig-paths";
import { codecovRemixPlugin } from "@codecov/remix-vite-plugin";

export default defineConfig({
  plugins: [
    remix(),
    tsconfigPaths()
    // Put the Codecov Remix plugin after all other plugins
    codecovRemixPlugin({
      enableBundleAnalysis: true,
      bundleName: "example-remix-bundle",
      uploadToken: process.env.CODECOV_TOKEN,
    }),
  ],
});
```

## OIDC 配置示例

用户 [启用 OpenID 连接( OIDC)](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect),设置 `uploadToken` 没有必要。 您可以使用 OIDC 与 `oidc` 配置如下.

```ts
// vite.config.ts
import { vitePlugin as remix } from "@remix-run/dev";
import { defineConfig } from "vite";
import tsconfigPaths from "vite-tsconfig-paths";
import { codecovRemixPlugin } from "@codecov/remix-vite-plugin";

export default defineConfig({
  plugins: [
    remix(),
    tsconfigPaths()
    // Put the Codecov Remix plugin after all other plugins
    codecovRemixPlugin({
      enableBundleAnalysis: true,
      bundleName: "example-remix-bundle",
      oidc: {
        useGitHubOIDC: true,
      },
    }),
  ],
});
```

## 更多信息

-   [编码文档](https://docs.codecov.com/docs)
-   [编解码器反馈](https://github.com/codecov/feedback/discussions)
-   [哨兵碎片](https://discord.gg/Ww9hbqr)

## 常见问题

### @codecov/remix-vite-plugin 是什么？

正式的 Codecov Remix 插件

### 如何安装 @codecov/remix-vite-plugin？

在项目目录运行 npm install @codecov/remix-vite-plugin，或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖：remix（2\.x）。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖，Yarn 需要手动安装。

### @codecov/remix-vite-plugin 支持 TypeScript 吗？

支持。包内自带 TypeScript 类型声明（package\.json 声明了 types 入口），安装后即可获得类型提示，无需再安装 @types 包。

### @codecov/remix-vite-plugin 支持 ESM 还是 CommonJS？

同时提供 ES Module 与 CommonJS 入口，import 和 require\(\) 都可以使用，打包工具会自动选择合适的版本。

### @codecov/remix-vite-plugin 需要什么版本的 Node\.js？

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

### @codecov/remix-vite-plugin 可以商用吗？

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

### @codecov/remix-vite-plugin 的下载量有多少？

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

### @codecov/remix-vite-plugin 还在维护吗？

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

