editframe-vite-plugin
Vite Plugin
When do you need this?
You need the Vite plugin when your composition references local video files. Without it, the browser can't play raw video files — they must be transcoded to streamable ISOBMFF format first.
Already included in all project templates (npm create @editframe). You only need to install it manually when adding Editframe to an existing Vite project.
| Scenario | Need this? |
|---|---|
Compositions with local .mp4/.mov files |
Yes — JIT transcoding |
| Compositions with remote URLs only | No |
| Adding Editframe to existing Vite project | Yes — install manually |
| Visual regression tests with Vitest | Yes — use vitest entry point |
Bundling for Cloud Rendering
For cloud rendering (npx editframe cloud-render), the build must produce a single self-contained dist/index.html with all JS and CSS inlined. Use vite-plugin-singlefile alongside this plugin:
// vite.config.ts
import { defineConfig } from "vite";
import { vitePluginEditframe } from "@editframe/vite-plugin";
import { viteSingleFile } from "vite-plugin-singlefile";
import react from "@vitejs/plugin-react"; // React projects only
export default defineConfig({
plugins: [
vitePluginEditframe({ root: "./src", cacheRoot: "./src/assets" }),
viteSingleFile(),
react(), // React projects only
],
});
npm install vite-plugin-singlefile
Both plugins are already included in all npm create @editframe project templates — this is only needed when setting up an existing project manually.
The Dev Loop with This Plugin
npm run dev
↓
Vite starts + plugin registers middleware
↓
Composition loads video src="/src/assets/clip.mp4"
↓
Plugin transcodes on first request → cached in cacheRoot/
↓
Subsequent loads → served from cache (fast)
The @editframe/vite-plugin adds local development capabilities to your Vite project. It handles on-demand video transcoding, local asset serving, and visual regression testing so you can develop Editframe compositions without cloud API dependencies.
Installation
npm install @editframe/vite-plugin
Configuration
// vite.config.ts
import { defineConfig } from "vite";
import { vitePluginEditframe } from "@editframe/vite-plugin";
export default defineConfig({
plugins: [
vitePluginEditframe({
root: "./src", // Base directory for resolving file paths
cacheRoot: "./cache", // Directory for cached transcoded assets
}),
],
});
Reference
- references/getting-started.md — Installation and configuration options
- references/jit-transcoding.md — How on-demand video transcoding works
- references/local-assets.md — Local image and caption serving
- references/file-api.md — File API endpoints
- references/visual-testing.md — Visual regression testing with Vitest
More from editframe/skills
video-analysis
Analyze video files using ffprobe, mp4dump, and jq. Use when investigating video samples, keyframes, MP4 box structure, codec info, packet timing, or debugging video playback issues.
75visual-thinking
Create visual analogies by mapping relational structure from familiar domains onto unfamiliar concepts using spatial relationships to make abstract patterns concrete. Covers static diagrams AND animated video storytelling (camera choreography, race comparisons, pacing). Use when explaining complex concepts, creating analogies, designing diagrams, creating explainer animations, or revealing system structure.
71css-animations
CSS animation fill-mode requirements for Editframe timeline system. Use when creating CSS animations, debugging flashing/flickering issues, or when user mentions animation problems, fade effects, slide effects, or sequential animations.
69threejs-compositions
Integrate Three.js 3D scenes into Editframe compositions via addFrameTask. Scenes are pure functions of time, fully scrubable, and renderable to MP4. Use when creating 3D animations, WebGL content in compositions, or integrating Three.js with Editframe's timeline system.
66editor-gui
Build video editing interfaces using Editframe's GUI web components. Assemble timeline, scrubber, filmstrip, preview, and playback controls like lego bricks. Use when creating video editors, editing tools, or when user mentions timeline, scrubber, preview, playback controls, trim handles, or wants to build editing UIs.
64elements-new-package
Create a new @editframe/* workspace package in the elements monorepo and publish it to npm.
64