ue-webui-bridge-vite
v1.0.1
Published
Vite plugin for UE WebUI Bridge - Automatically integrate UE WebUI bridge functionality at build time
Maintainers
Readme
ue-webui-bridge-vite
UE WebUI Bridge 的 Vite 插件,用于在构建时自动集成 UE WebUI 桥接功能。
📦 安装
同时安装核心库和 Vite 插件:
npm install ue-webui-bridge
npm install ue-webui-bridge-vite -D🚀 快速开始
1. 配置 Vite 插件
在 vite.config.ts 中配置插件:
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import ueWebUiBridge from 'ue-webui-bridge-vite';
export default defineConfig({
plugins: [vue(), ueWebUiBridge()],
});2. 使用 API
配置插件后,可以直接使用 ue-webui-bridge 的 API,无需手动调用 initUEBridge():
import { sendToGame, registerGameInterface } from 'ue-webui-bridge';
// 发送消息到 UE
sendToGame('PlayerAction', { action: 'jump' });
// 接收来自 UE 的消息
registerGameInterface('OnGameEvent', (data) => {
console.log('收到游戏事件:', data);
});✨ 功能特性
1. 自动初始化
插件会自动注入 UE 桥接初始化代码,无需手动调用 initUEBridge()。
2. 资源路径优化
自动配置资源路径,确保在 UE WebUI 中正确加载所有资源文件。
3. 兼容性保证
确保构建产物能够在 UE 内置浏览器中正常运行,无需额外配置。
4. 开箱即用
零配置,安装即可使用,插件会自动处理所有必要的构建优化。
📋 配置选项
插件采用零配置设计,开箱即用,无需任何额外配置。
🎯 使用场景
此插件适用于以下场景:
- 使用 Vite 构建的 Vue/React/Svelte 等项目
- 需要在 Unreal Engine 的 WebUI 中运行的 Web 应用
- 需要与 UE 进行双向通信的前端项目
📦 依赖关系
Dependencies
@vitejs/plugin-legacy- 提供旧版浏览器支持
Peer Dependencies
vite- 支持版本 ^5.0.0 || ^6.0.0 || ^7.0.0
🔗 相关项目
- ue-webui-bridge - 核心库,提供运行时 API
📝 注意事项
- 无需手动初始化: 使用此插件后,不需要在代码中手动调用
initUEBridge() - 自动路径处理: 插件会自动处理资源路径,确保在 UE 中正确加载
- 浏览器兼容: 构建产物已针对 UE 内置浏览器进行优化
- 必须同时安装: 需要同时安装
ue-webui-bridge核心库和本插件
📄 许可证
GPL-3.0 © kongziming
