Skip to content

🎥 Make videos programmatically with React

`@remotion/studio-server`: Refine staticFile fallback log message

Jonny Burger876b5f78c783
diff --git a/packages/studio-server/src/routes.ts b/packages/studio-server/src/routes.ts
index b3aa9d32da..5215ceb738 100644
--- a/packages/studio-server/src/routes.ts
+++ b/packages/studio-server/src/routes.ts
@@ -111,11 +111,20 @@ const handleFallback = async ({
pathname: requestUrl.pathname,
publicDir,
});
- if (staticFileHint && !loggedStaticFileHints.has(staticFileHint)) {
+ const pathname = requestUrl.pathname;
+ if (
+ staticFileHint &&
+ pathname.includes('.') &&
+ !loggedStaticFileHints.has(staticFileHint)
+ ) {
loggedStaticFileHints.add(staticFileHint);
- RenderInternals.Log.warn(
+ RenderInternals.Log.error(
{indent: false, logLevel},
- `"${requestUrl.pathname}" does not resolve from the root URL, but "public/${staticFileHint}" exists. Use staticFile("${staticFileHint}") instead.`,
+ [
+ `"${pathname}" was requested but not found.`,
+ 'To import assets from the public/ folder, you must wrap them in staticFile(): https://www.remotion.dev/docs/assets',
+ `Change \`"${pathname}"\` to \`staticFile("${pathname}")\` to fix the error.`,
+ ].join('\n'),
);
}