Repository navigation
fix(ffmpeg): resolve classWorkerURL in the UMD build - #93
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 57 minutes. View limit detailsLimit details: You’ve used the included review currently available. Review configuration: ⚙️ Run configuration
📒 Files selected for processing (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
The change fixes the UMD build's handling of classWorkerURL by introducing a helper function resolveWorkerURL that uses self.location.href as the base for UMD builds and import.meta.url for ESM builds. This prevents Webpack from misinterpreting non-literal URLs as module lookups. The CHANGELOG is updated to reflect the fix.
review-bot, model nvidia/nemotron-3-super-120b-a12b:free, verdict approve
load({ classWorkerURL })fails in the UMD build withCannot find module 'blob:...'. Webpack compilesnew URL(classWorkerURL, import.meta.url)with a non-literal first argument into a module context lookup, so any URL passed at runtime misses.The URL is now built through a helper. The ESM build still resolves it against
import.meta.url. The UMD build has no module URL, so it resolves againstself.location.href, which is whatnew Worker()does with a relative URL anyway.Checked by building
dist/umd/ffmpeg.jsbefore and after: the old bundle contains theCannot find modulestub, and the new one callsnew Worker(new URL(url, self.location.href)). #88's browser test passes ablob:classWorkerURLthrough the UMD build and will exercise this once rebased.