Skip to content

Dev server: log hint to use staticFile() when a 404’d URL matches a public/ file #7001

@JonnyBurger

Description

@JonnyBurger

Idea

When the Remotion Studio / webpack dev server handles a request that 404s (or otherwise does not resolve to a served asset), but a file with the same path suffix exists under the project public/ folder, print a developer-facing message (e.g. on the server console) suggesting to reference it with staticFile() instead of a root-relative URL like /video.mp4.

Motivation

Files in public/ are exposed under the hashed static URL (e.g. /static-<hash>/…), not necessarily at the root path (/video.mp4). Using /video.mp4 in <Video src> or similar often results in 404 even though the file exists in public/. A clear nudge at request time would shorten the debugging loop.

Docs: https://www.remotion.dev/docs/staticfile

Example

  • Request: GET /video.mp4 → 404 (or SPA fallback).
  • On disk: public/video.mp4 exists.
  • Expected: log something like:
    The file exists in public/ as "video.mp4". Use staticFile("video.mp4") or the correct static URL instead of "/video.mp4".

Scope / notes

  • Likely touches the preview server routing and/or fallthrough handler (e.g. packages/studio-server/src/routes.ts, static serveStatic handling in packages/studio-server/src/preview-server/serve-static.ts).
  • Decide when to emit the hint (only on 404? only for GET? debounce noisy paths?).
  • Consider matching rules (basename vs full relative path under public/).

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions