Back to Remotion

staticFile() does not support relative paths

packages/docs/docs/static-file-relative-paths.mdx

4.0.4661.1 KB
Original Source

If you got the following error message:

staticFile() does not support relative paths. Instead, pass the name of a file that is inside the public/ folder.

You have tried to pass a relative path to staticFile():

tsx
import { staticFile } from "remotion";
staticFile("../public/image.png");
tsx
import { staticFile } from "remotion";
staticFile("./image.png");

Or you tried to pass an absolute path:

tsx
import { staticFile } from "remotion";
staticFile("/Users/bob/remotion-project/public/image.png");

Or you tried to add a public/ fix which is unnecessary:

tsx
import { staticFile } from "remotion";
staticFile("public/image.png");

Instead, pass the name of the file that is inside the public folder directly:

tsx
import { staticFile } from "remotion";
staticFile("image.png");

See also