Skip to content

fix: use dynamic imports for optional ffmpeg dependencies#62

Merged
genu merged 2 commits intomasterfrom
genu/dynamic-ffmpeg-imports
Feb 23, 2026
Merged

fix: use dynamic imports for optional ffmpeg dependencies#62
genu merged 2 commits intomasterfrom
genu/dynamic-ffmpeg-imports

Conversation

@genu
Copy link
Owner

@genu genu commented Feb 23, 2026

Summary

  • Moved @ffmpeg/ffmpeg and @ffmpeg/util from static top-level imports to dynamic import() calls inside load()
  • These are optional peer dependencies; static imports cause resolution errors for consumers without them installed
  • FFmpeg instance and fetchFile function are stored in closure variables for access by other methods

Changes

  • useFFMpeg.ts: Deferred FFmpeg instantiation and import resolution to load() method
  • useFFMpeg.test.ts: Added 15 comprehensive tests covering dynamic imports, progress tracking, command construction, and error handling

All 380 tests pass.

…encies

Move @ffmpeg/ffmpeg and @ffmpeg/util from top-level static imports to dynamic
imports inside the load() function. Since these are optional peer dependencies,
static imports cause resolution errors for consumers who don't have them installed.

The FFmpeg instance and fetchFile function are now stored in closure variables
so other methods like convert() can still access them after load() completes.

Includes comprehensive test coverage for dynamic import behavior, progress tracking,
command construction, and file cleanup.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Feb 23, 2026

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

Project Deployment Actions Updated (UTC)
nuxt-upload-kit-docs Ready Ready Preview, Comment Feb 23, 2026 3:17pm

Move useFFMpeg import to top of test file to satisfy import/first rule
and correct the video-compressor docs to show the actual composable API.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@genu genu changed the title refactor: use dynamic imports for optional ffmpeg dependencies fix: use dynamic imports for optional ffmpeg dependencies Feb 23, 2026
@genu genu merged commit a1a0eea into master Feb 23, 2026
4 checks passed
@genu genu deleted the genu/dynamic-ffmpeg-imports branch February 23, 2026 15:18
@genu genu mentioned this pull request Feb 23, 2026
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