mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-12-01 21:05:42 +09:00
fix: remove Wrangler isbot import warning (#6695)
Wrangler warned that the generated Cloudflare server bundle checked for an `isbot` default export that does not exist. The Cloudflare template now uses the named export directly and keeps bot rendering behavior intact. No user-facing documentation changes are needed; this only changes the generated Cloudflare server entry. ## Checklist - [x] Trace the generated import to Remix's built-in Cloudflare entry and use the supported `isbot` export. - [x] Regenerate the Cloudflare fixture from the template. - [x] Verify the Cloudflare production build no longer emits the warning. - [x] Run the focused prebuild test, fixture typecheck, lint, formatting, and diff checks. - [ ] Review the final diff and worktree for unrelated changes. - [ ] Verify all required CI checks for the latest commit. ## Verification - Cloudflare Remix production build passed. - Wrangler Pages Functions build passed with unrelated, unbuilt workspace packages externalized; the `isbot` warning was absent. - Focused prebuild test, fixture typecheck, lint, formatting, and `git diff --check` passed.
This commit is contained in:
1 parent
cdca13c755
commit
57e3a7e785
2 files changed
+66
No files matched your search
@@ -0,0 +1,33 @@
|
||||
import type { AppLoadContext, EntryContext } from "@remix-run/cloudflare";
|
||||
import { RemixServer } from "@remix-run/react";
|
||||
import { isbot } from "isbot";
|
||||
import { renderToReadableStream } from "react-dom/server";
|
||||
|
||||
export default async function handleRequest(
|
||||
request: Request,
|
||||
responseStatusCode: number,
|
||||
responseHeaders: Headers,
|
||||
remixContext: EntryContext,
|
||||
_loadContext: AppLoadContext
|
||||
) {
|
||||
const body = await renderToReadableStream(
|
||||
<RemixServer context={remixContext} url={request.url} />,
|
||||
{
|
||||
onError(error: unknown) {
|
||||
console.error(error);
|
||||
responseStatusCode = 500;
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
const userAgent = request.headers.get("user-agent");
|
||||
if (userAgent && isbot(userAgent)) {
|
||||
await body.allReady;
|
||||
}
|
||||
|
||||
responseHeaders.set("Content-Type", "text/html");
|
||||
return new Response(body, {
|
||||
headers: responseHeaders,
|
||||
status: responseStatusCode,
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
import type { AppLoadContext, EntryContext } from "@remix-run/cloudflare";
|
||||
import { RemixServer } from "@remix-run/react";
|
||||
import { isbot } from "isbot";
|
||||
import { renderToReadableStream } from "react-dom/server";
|
||||
|
||||
export default async function handleRequest(
|
||||
request: Request,
|
||||
responseStatusCode: number,
|
||||
responseHeaders: Headers,
|
||||
remixContext: EntryContext,
|
||||
_loadContext: AppLoadContext
|
||||
) {
|
||||
const body = await renderToReadableStream(
|
||||
<RemixServer context={remixContext} url={request.url} />,
|
||||
{
|
||||
onError(error: unknown) {
|
||||
console.error(error);
|
||||
responseStatusCode = 500;
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
const userAgent = request.headers.get("user-agent");
|
||||
if (userAgent && isbot(userAgent)) {
|
||||
await body.allReady;
|
||||
}
|
||||
|
||||
responseHeaders.set("Content-Type", "text/html");
|
||||
return new Response(body, {
|
||||
headers: responseHeaders,
|
||||
status: responseStatusCode,
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user