Registry /
llm-agents / vite-plugin-chatgpt-widgets
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
muslnode 18–223 runs
build_error
glibcnode 18–223 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);
}
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.
fixAdd 'build: { manifest: true }' to vite.config.ts. Error: Cannot find module 'vite-plugin-chatgpt-widgets'
Package not installed or incorrect import path.
fixRun '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.
fixUse 'import' instead of 'require'.
Error: A widget must export a default component
Widget file does not have a default export.
fixAdd 'export default function WidgetName() { ... }' to the widget file. 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.