{"record":{"id":"73f7857a56d06a34","repo":"remotion-dev/remotion","slug":"watchstaticfile-has-moved-into-the-remotion-st","errorCode":null,"errorMessage":"watchStaticFile() has moved into the `@remotion/studio` package. Update your imports.","messagePattern":"watchStaticFile\\(\\) has moved into the `@remotion/studio` package\\. Update your imports\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/watch-static-file.ts","lineNumber":22,"sourceCode":"\ntype WatcherCallback = (newData: StaticFile | null) => void;\n\nexport const WATCH_REMOTION_STATIC_FILES = 'remotion_staticFilesChanged';\n\nexport type WatchRemotionStaticFilesPayload = {\n\tfiles: StaticFile[];\n};\n\n/*\n * @description Watches for changes in a specific static file and invokes a callback function when the file changes, enabling dynamic updates in your Remotion projects.\n * @see [Documentation](https://www.remotion.dev/docs/watchstaticfile)\n */\nexport const watchStaticFile = (\n\tfileName: string,\n\tcallback: WatcherCallback,\n): {cancel: () => void} => {\n\tif (ENABLE_V5_BREAKING_CHANGES) {\n\t\tthrow new Error(\n\t\t\t'watchStaticFile() has moved into the `@remotion/studio` package. Update your imports.',\n\t\t);\n\t}\n\n\t// Check if function is called in Remotion Studio\n\tif (!getRemotionEnvironment().isStudio) {\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.warn(\n\t\t\t'The watchStaticFile() API is only available while using the Remotion Studio.',\n\t\t);\n\t\treturn {cancel: () => undefined};\n\t}\n\n\tconst withoutStaticBase = fileName.startsWith(window.remotion_staticBase)\n\t\t? fileName.replace(window.remotion_staticBase, '')\n\t\t: fileName;\n\tconst withoutLeadingSlash = withoutStaticBase.startsWith('/')\n\t\t? withoutStaticBase.slice(1)","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/core/src/watch-static-file.ts#L4-L40","documentation":"Thrown by `watchStaticFile` when `ENABLE_V5_BREAKING_CHANGES` is true. In Remotion v5, `watchStaticFile` has moved out of `remotion`/`@remotion/core` and into `@remotion/studio`. The throw is a hard migration signal: the function still exists in the old location only to fail loudly and tell users to update imports.","triggerScenarios":"Calling `watchStaticFile` imported from `remotion` or `@remotion/core` while running against Remotion v5 (where ENABLE_V5_BREAKING_CHANGES is enabled). The check is the first statement in the function body, so it fires on any call.","commonSituations":"Upgrading a project to Remotion v5 without migrating the watchStaticFile import; a v4/v5 shared codebase running with the v5 flag flipped on.","solutions":["Change the import: `import {watchStaticFile} from '@remotion/studio';` instead of from `remotion`.","After migrating, ensure the call still only runs inside Remotion Studio (the function warns otherwise).","Remove the old import site entirely to avoid accidental re-use."],"exampleFix":"// before\nimport {watchStaticFile} from 'remotion';\n\n// after\nimport {watchStaticFile} from '@remotion/studio';","handlingStrategy":"type-guard","validationCode":"import {ENABLE_V5_BREAKING_CHANGES} from 'remotion/v5-flag';\n\nif (ENABLE_V5_BREAKING_CHANGES) {\n  // import watchStaticFile from '@remotion/studio' instead\n}","typeGuard":"const watchStaticFileLivesInStudio = (): boolean =>\n  Boolean(ENABLE_V5_BREAKING_CHANGES);","tryCatchPattern":null,"preventionTips":["When upgrading to v5, search-and-replace the watchStaticFile import to @remotion/studio.","Run the v5 migration guide's codemod if available.","Keep watchStaticFile calls inside Studio-only code paths."],"tags":["v5","migration","studio","breaking-change"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}