fix: decouple editor plugin injection from core so headless renders work#392
Merged
Conversation
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).
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On a canary-scaffolded project,
npm run renderhangs and never produces a video.Root cause:
makeProject'saddEditorToProject()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, whoseimport-analysisrejects 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
addEditorToProjectand its hardcoded/@id/dynamic import. Core no longer contains any Vite-internal string, so nothing leaks into a render bundle.scene.plugins, the mechanismProject.plugins' own JSDoc documents). The/@id/URL is now constructed here, where it belongs.getVersions(), replacing core's hardcodedcreateVersionObject('0.10.4')(the editor footer is the only consumer; versions are never used in a render). Also fixedgetVersionsso the vite-plugin's own version resolves ('..'→'@revideo/vite-plugin').moduleResolutionalongsidemodule: CommonJSso the render tsconfig compiles (the base now shipsbundler, which conflicts → TS5095).Validation (all under the renderer's Vite 8)
npm run template:rendernow producesoutput/video.mp4(2.0 MB); previously it hung on the/@id/@revideo/2d/editorimport-analysiserror./@id/@revideo/2d/editorresolves200(real plugin module), and the footer now shows real versions instead of a hardcoded0.10.4.Related
moduleResolutionfix; that's a companion PR in the examples repo: fix: add moduleResolution to render tsconfigs examples#29.