Skip to main content

deleteComposition()v4.0.528

Removes a composition or still registration.

warning

Draft API: This API is experimental and may change.

delete-composition.ts
import {deleteComposition, type CodemodProject} from '@remotion/codemods'; declare const project: CodemodProject; const result = deleteComposition({ project, compositionFile: 'src/Root.tsx', compositionId: 'MyComposition', }); console.log(result);

Keeps component implementations, imports, and media files. A missing or ambiguous composition ID throws an error.

Options​

project​

An in-memory CodemodProject. The input project is not mutated.

compositionFile​

The project file containing the composition registrations. Registration edits support <Composition>, <Still>, and <Folder> with static IDs or folder names. Aliased and namespace imports from remotion are supported.

compositionId​

The static ID of the composition to edit.

Return value​

Returns an object with the following properties.

changes​

An array of {filePath, previousContents, nextContents} file changes. A null content value indicates a created or deleted file.

nodePathRemappingsv4.0.530​

An array of {filePath, oldNodePath, newNodePath} mappings. A null old path indicates an insertion; a null new path indicates removal. Apply these mappings to references from the input project. See node references.

Errors​

Throws when the target cannot be resolved, the requested edit is unsupported, or an option is invalid. Failed edits leave the input project unchanged.

Compatibility​

BrowsersServersEnvironments
Chrome
Firefox
Safari
Node.js
Bun
Serverless Functions

See also​