Repository navigation
Docs: Note that bundle() does not delete its temporary directory - #13665
Open
conorbronsdon wants to merge 2 commits into
Open
conorbronsdon wants to merge 2 commits into
conorbronsdon wants to merge 2 commits into
Conversation
Without `outDir`, `bundle()` creates a `remotion-webpack-bundle-*` folder in `os.tmpdir()` and never removes it. Say so under `outDir` and show deleting the returned path after rendering. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
conorbronsdon
marked this pull request as ready for review
November 29, 2026 22:11
Contributor
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — Reviewed the documentation updates describing temporary bundle directory cleanup and showing a finally cleanup example.
outDir?documentation — Clarifies that Remotion leaves the temporary directory in place and links to the return value section.- Return value example — Shows rendering from the returned bundle path and removing that path after use.
gpt-6-luna | 𝕏
Author
|
(note that I do think this behavior is worth looking at from a product design standpoint, but the docs should reflect it accurately for now at least) |
Author
|
Tightening this a bit but if you prefer the original up to you! |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch was successfully deployed
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.

When
outDiris not passed,bundle()creates a newremotion-webpack-bundle-*folder inos.tmpdir()and nothing deletes it. The CLI removes its bundle through its ownonDirectoryCreatedcleanup hook, but the Node.js API docs don't say that callers have to do this themselves.We hit this in a pipeline that called
bundle()once per render (the anti-pattern the page already warns about). It left 1,970 stale bundle folders, 81 GB in total, in%TEMP%on Windows. Bundling once avoids most of it, but the one bundle still stays on disk after the process exits.Changes to
packages/docs/docs/bundle.mdx:outDir?: say the temporary directory is not deleted, and link to the return value section.outDiris not passed, with a short example that bundles once and deletes the returned path in afinallyblock.How this was checked against the source at 6a07b17:
packages/bundler/src/bundle.tsL43-L52:prepareOutDir()callsfs.promises.mkdtemp(path.join(os.tmpdir(), 'remotion-webpack-bundle-'))when nooutDiris given.internalBundle()returns that path at L486 and never removes it.packages/cli/src/render-flows/render.tsL375-L378: the CLI registersRenderInternals.deleteDirectory(dir)fromonDirectoryCreated, which is why CLI renders don't leak.@remotion/lambda: Clean up generated site bundles #9569 added the same kind of cleanup for the bundles that LambdadeploySite()generates.The snippet is a
twoslashblock. I couldn't run the docs build locally (this machine has Bun 1.3.14 and the repo requires 1.4.3 or later), so the docs build in CI is what type-checks it.oxfmt@0.35.0 --checkwith the repo's.oxfmtrc.jsonpasses on the changed file.The example uses the return value rather than
onDirectoryCreated. That means abundle()call that throws partway through can still leave its folder behind. I left that case out to keep the note short.🤖 Generated with Claude Code