# @ckeditor/vite-plugin-ckeditor5 中文文档

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

版本：0\.1\.3
npm 元数据更新时间：2024-06-26T09:43:36.470Z
中文译文更新时间：2026-11-09T23:18:35.823Z
软件包许可：GPL-2\.0-or-later

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

原始 npm 页面：https://www.npmjs.com/package/%40ckeditor/vite-plugin-ckeditor5
原文对照：https://npmcn.com/package/%40ckeditor/vite-plugin-ckeditor5/?lang=original
项目主页：https://github.com/ckeditor/vite-plugin-ckeditor5
源码仓库：https://github.com/ckeditor/vite-plugin-ckeditor5

弃用说明：The Vite plugin is deprecated, and new versions will not be released\. CKEditor 5 version 42\.0\.0 works with Vite without any special setup\. For more information, read the migration guide: https://ckeditor\.com/docs/ckeditor5/latest/updating/nim-migration/customized-builds\.html

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

- 包体积（解压后）：16.5 kB，8 个文件
- 模块格式：ESM + CJS
- TypeScript 类型：包内自带
- Node.js 要求：^14\.18\.0 \|\| \>= 16
- 运行依赖：4 个
- 首次发布：2022-12-22T11:32:39.240Z
- 最新版本发布：2023-06-02T06:08:09.388Z
- 近 30 天下载量：41905（2026-10-10 至 2026-11-08，npm 官方下载统计）
- 已发布版本数：4（近 12 个月 0 个）

## 中文简介

CKEditor 5 Vite 插件 {}

## 安装

```sh
npm install @ckeditor/vite-plugin-ckeditor5
```

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

## README

# CKEditor 5 Vite 插件

整合 [电脑编辑 5](https://ckeditor.com/)'在您的创建过程中' [维特](https://vitejs.dev/) 设置.

## 实验特性

使用此插件从维特的源头来构建CKEditor 5仍然处于实验阶段. 我们鼓励你测试一下,给我们反馈。 然而,在更为复杂的应用/使用情况中可能存在一些问题,因此尚未建议在生产应用中使用这种解决办法.

## 使用量

您应该使用此插件时 [从源代码创建 CKEditor 5](https://ckeditor.com/docs/ckeditor5/latest/installation/advanced/alternative-setups/integrating-from-source.html) 在Vite应用程序中。 它处理装入 `.svg` 图标和样式。 如果您的编辑器已经建好了( 例如您从 [CKEditor 5 在线构建器](https://ckeditor.com/ckeditor-5/online-builder/))那么此插件就不需要了.

1.  安装软件包 .

```bash
npm install -D @ckeditor/vite-plugin-ckeditor5
# or
yarn add -D @ckeditor/vite-plugin-ckeditor5
```

2.  导入并使用 Vite 配置中的插件 .

```js
// vite.config.js
import { defineConfig } from 'vite';
import ckeditor5 from '@ckeditor/vite-plugin-ckeditor5';

export default defineConfig( {
    plugins: [
        ckeditor5( { theme: require.resolve( '@ckeditor/ckeditor5-theme-lark' ) } )
    ]
} );
```

### 选项 :

#### `theme`

这应该是主题包中的主文件的绝对路径. 示例

```js
{ theme: require.resolve( '@ckeditor/ckeditor5-theme-lark' ) }
```

注意: 如果您在无害环境管理项目中使用了此插件, 您可能会遇到一个错误 `require.resolve` 不是一个函数。 在此情况下,您可以在您的顶部添加以下内容: `vite.config.js` 文件 :

```js
import { createRequire } from 'node:module';
const require = createRequire( import.meta.url );
```

## 已知问题

-   此插件不会发出任何翻译文件, 目前只支持英语 .
-   当使用"导出为Word"或"导出为PDF"插件时,编辑器样式不会自动被收集.

## 释放软件包

### 更改日志

在启动发布进程之前, 您需要生成更改日志 :

```bash
npm run changelog
```

### 出版

生成更改日志后, 您可以发布软件包 .

首先,你需要撞出版本:

```bash
npm run release:bump-version
```

你也可以使用这个 `--dry-run` 选项,以查看任务的效果.

撞出版本后,您可以发布更改 :

```bash
npm run release:publish
```

与先前的任务一样 `--dry-run` 选项.

注:只有 `dist/` 目录将公布.

## 许可证

根据下列规定获得许可证: [GNU 通用公共许可证版本 2 或稍后版本](http://www.gnu.org/licenses/gpl.html)请检查date=中的日期值 (帮助) `LICENSE.md` 文档.

## 常见问题

### @ckeditor/vite-plugin-ckeditor5 是什么？

CKEditor 5 Vite 插件 \{\}注意：该包已被作者标记为弃用——The Vite plugin is deprecated, and new versions will not be released\. CKEditor 5 version 42\.0\.0 works with Vite without any special setup\. For more information, read the migration guide: https://ckeditor\.com/docs/ckeditor5/latest/updating/nim-migration/customized-builds\.html

### 如何安装 @ckeditor/vite-plugin-ckeditor5？

在项目目录运行 npm install @ckeditor/vite-plugin-ckeditor5，或使用 pnpm add / yarn add / bun add。

### @ckeditor/vite-plugin-ckeditor5 支持 TypeScript 吗？

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

### @ckeditor/vite-plugin-ckeditor5 支持 ESM 还是 CommonJS？

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

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

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

### @ckeditor/vite-plugin-ckeditor5 可以商用吗？

@ckeditor/vite-plugin-ckeditor5 使用 GPL-2\.0-or-later 许可。强 Copyleft：分发包含该代码的软件时，整个作品需以兼容的 GPL 许可开源。仅在内部使用、不对外分发时不触发此义务。以上为概括，不构成法律意见，请以许可原文为准。

### @ckeditor/vite-plugin-ckeditor5 的下载量有多少？

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

### @ckeditor/vite-plugin-ckeditor5 还在维护吗？

最新版本 0\.1\.3 发布于 2023/06/02（3 年前）；至今共发布 4 个版本，其中过去 12 个月发布了 0 个；首次发布于 2022/12/22。作者已将其标记为弃用，新项目建议寻找替代方案。

