Registry / llm-agents / vite-plugin-chatgpt-widgets

vite-plugin-chatgpt-widgets

JSON →
library0.0.10jsnpmunverified

v0.0.10 – Vite plugin to automatically bundle React-based ChatGPT widget outputs within a Vite project. Supports both dynamic development builds (via Vite dev server) and production builds (via manifest file). Key differentiator: it automates widget discovery and HTML generation for MCP server resource registration, enabling ChatGPT sandboxed iframe integration. Release cadence is irregular; latest version focuses on dependency optimization. Requires React and OpenAI SDK UI packages. Active development by Gadget. Currently no major breaking changes known.

npm install vite-plugin-chatgpt-widgets
INSTALL
IMPORT
SIG · VITE-PLUGIN-CHATGP
V
vite-plugin-chatgpt-widgets
llm-agentsjavascriptv0.0.10
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

chatGPTWidgetPlugin
import { chatGPTWidgetPlugin } from 'vite-plugin-chatgpt-widgets'
import chatGPTWidgetPlugin from 'vite-plugin-chatgpt-widgets'
This is a named export, not a default export.
getWidgets
import { getWidgets } from 'vite-plugin-chatgpt-widgets'
const { getWidgets } = require('vite-plugin-chatgpt-widgets')
Package is ESM-only; CommonJS require is not supported.
default
import { chatGPTWidgetPlugin } from 'vite-plugin-chatgpt-widgets'
import chatGPTWidgetPlugin from 'vite-plugin-chatgpt-widgets'
The package does not export a default; use named import.

Demonstrates basic Vite plugin configuration and server-side widget retrieval using getWidgets.

import { defineConfig } from 'vite'; import { chatGPTWidgetPlugin } from 'vite-plugin-chatgpt-widgets'; import { getWidgets } from 'vite-plugin-chatgpt-widgets'; // vite.config.ts export default defineConfig({ plugins: [ chatGPTWidgetPlugin({ widgetsDir: 'web/chatgpt', baseUrl: process.env.BASE_URL ?? 'http://localhost:3000', }), ], build: { manifest: true }, server: { cors: { origin: true } }, }); // In your server code (e.g., MCP server) const widgets = await getWidgets('web/chatgpt', { manifestPath: 'dist/.vite/manifest.json', }); for (const widget of widgets) { console.log(widget.name, widget.content); }
Debug
Known issues
gotchaManifest must be enabled for production builds: 'build.manifest' must be set to true in vite.config.
fix
Add 'build: { manifest: true }' to your Vite config.
affects: >=0.0.1
gotchaBase URL required for sandboxed iframes: if not using Vite's 'base' option, a 'baseUrl' must be provided to the plugin options.
fix
Pass 'baseUrl' in plugin options or set 'base' in Vite config.
affects: >=0.0.1
gotchaWidget components must use default export: the plugin only picks up default exports from widget files.
fix
Ensure each widget component is exported as 'export default function WidgetName'.
affects: >=0.0.1
gotchaRoot layout component must accept 'children' prop: the optional root.tsx file must export a component that accepts React.ReactNode as children.
fix
Define 'export default function RootLayout({ children }: { children: React.ReactNode })'.
affects: >=0.0.5
deprecatedOld module IDs before v0.0.7 might cause ambiguity between JS and HTML entrypoints.
fix
Upgrade to v0.0.7 or later to use clearer module IDs.
affects: <0.0.7
Errors
Common errors & fixes
Error: No manifest found. Ensure that 'build.manifest' is enabled in your Vite config.
Production build without manifest enabled cannot locate built widget files.
fix
Add 'build: { manifest: true }' to vite.config.ts.
Error: Cannot find module 'vite-plugin-chatgpt-widgets'
Package not installed or incorrect import path.
fix
Run 'npm install vite-plugin-chatgpt-widgets' and use the correct import (named export).
Error: `require` is not defined in ES module scope
Using CommonJS require() in an ESM-only environment.
fix
Use 'import' instead of 'require'.
Error: A widget must export a default component
Widget file does not have a default export.
fix
Add 'export default function WidgetName() { ... }' to the widget file.
Upgrade
Version history
0.0.10latest on npm
Audit
Dependencies
viterequiredThe plugin is a Vite plugin and must be used within a Vite project.
reactrequiredWidget components are React components; React is required at runtime.
@openai/apps-sdk-uioptionalUsed for ChatGPT-specific UI components and sandbox integration.
Agent activity
39 hits · last 30 days
node
32
Perplexity
1
OpenAI (training)
1
Resources