Skip to content

fix: decouple editor plugin injection from core so headless renders work#392

Merged
hkonsti merged 2 commits into
mainfrom
hkonsti/implement-fix
Jul 10, 2026
Merged

fix: decouple editor plugin injection from core so headless renders work#392
hkonsti merged 2 commits into
mainfrom
hkonsti/implement-fix

Conversation

@hkonsti

@hkonsti hkonsti commented Jul 10, 2026

Copy link
Copy Markdown
Member

Problem

On a canary-scaffolded project, npm run render hangs and never produces a video.

Root cause: makeProject's addEditorToProject() baked a Vite dev-server-internal URL (/@id/@revideo/2d/editor) into @revideo/core. Every project — including headless renders — imports core, so that string rides into the render bundle. The renderer bundles its own Vite 8, whose import-analysis rejects the unresolvable /@id/ id in the optimized core dep, wedging the render page (Puppeteer then waits forever). It didn't surface before because the editor runs on the project's Vite 4.5, which tolerated it.

Fix

  • core — remove addEditorToProject and its hardcoded /@id/ dynamic import. Core no longer contains any Vite-internal string, so nothing leaks into a render bundle.
  • vite-plugin — inject editor plugins in the dev-only editor entry instead, driven by each scene's declared plugin specifiers (scene.plugins, the mechanism Project.plugins' own JSDoc documents). The /@id/ URL is now constructed here, where it belongs.
  • vite-plugin — while instantiating the project for the editor, also inject the real per-package versions via the previously-commented-out getVersions(), replacing core's hardcoded createVersionObject('0.10.4') (the editor footer is the only consumer; versions are never used in a render). Also fixed getVersions so the vite-plugin's own version resolves ('..''@revideo/vite-plugin').
  • template — set moduleResolution alongside module: CommonJS so the render tsconfig compiles (the base now ships bundler, which conflicts → TS5095).

Validation (all under the renderer's Vite 8)

  • Render: npm run template:render now produces output/video.mp4 (2.0 MB); previously it hung on the /@id/@revideo/2d/editor import-analysis error.
  • Editor: dev server (Vite 8) — the generated entry emits the new code, /@id/@revideo/2d/editor resolves 200 (real plugin module), and the footer now shows real versions instead of a hardcoded 0.10.4.
  • core / vite-plugin / renderer build clean; prettier + eslint pass.

Related

Renders were hanging under the renderer's Vite 8: makeProject's
addEditorToProject() baked a Vite dev-server-internal URL
(/@id/@revideo/2d/editor) into @revideo/core, which every project —
including headless renders — imports. Vite 8's import-analysis rejects
the unresolvable id in the optimized core bundle and the render page
never loads.

- core: remove addEditorToProject and its hardcoded /@id/ import; core
  no longer contains any Vite-internal string.
- vite-plugin: inject editor plugins in the dev-only editor entry,
  driven by each scene's declared plugin specifiers (scene.plugins),
  constructing the /@id/ URL where it belongs — never in a render bundle.
- vite-plugin: also inject the real, per-package versions (via the
  previously-disabled getVersions()) into the editor entry, replacing
  core's hardcoded createVersionObject('0.10.4'); fix getVersions so the
  vite-plugin's own version resolves.
- template: set moduleResolution alongside module: CommonJS so the
  render tsconfig compiles (TS5095).
@vercel

vercel Bot commented Jul 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
revideo-docs Ready Ready Preview, Comment Jul 10, 2026 12:47am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
revideo-docs-redirect Skipped Skipped Jul 10, 2026 12:47am

Request Review

Points to midrender/examples 1c9dff8 (#29), which adds moduleResolution
to the templates' render tsconfigs so a freshly scaffolded project
compiles under the bundler-based base config.
@vercel vercel Bot temporarily deployed to Preview – revideo-docs July 10, 2026 00:46 Inactive
@vercel vercel Bot temporarily deployed to Preview – revideo-docs-redirect July 10, 2026 00:46 Inactive
@hkonsti hkonsti merged commit 832b234 into main Jul 10, 2026
9 checks passed
@hkonsti hkonsti deleted the hkonsti/implement-fix branch July 10, 2026 00:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant