desvincula o app do Lovable e corrige preset de build para Node
Remove .lovable/, AGENTS.md (banner de sync), bun.lock/bunfig.toml (não usados, o build é via npm), lovable-error-reporting.ts, a dependência @lovable.dev/vite-tanstack-config e o branding Lovable nas metatags. vite.config.ts passa a configurar os plugins do TanStack Start/Tailwind/nitro diretamente, sem o wrapper deles. Nisso, corrige um bug crítico: o preset do nitro estava em cloudflare-module (gera um Cloudflare Worker), mas o Dockerfile roda o build direto com `node`. O container subiria sem escutar em porta nenhuma e o /healthz falharia sempre. Preset trocado para node-server.
This commit is contained in:
@@ -1,58 +0,0 @@
|
||||
type LovableErrorOptions = {
|
||||
mechanism?: "manual" | "onerror" | "unhandledrejection" | "react_error_boundary";
|
||||
handled?: boolean;
|
||||
severity?: "error" | "warning" | "info";
|
||||
};
|
||||
|
||||
type LovableEvents = {
|
||||
captureException?: (
|
||||
error: unknown,
|
||||
context?: Record<string, unknown>,
|
||||
options?: LovableErrorOptions,
|
||||
) => void;
|
||||
};
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
__lovableEvents?: LovableEvents;
|
||||
__lovableReportRuntimeError?: (payload: {
|
||||
message: string;
|
||||
stack?: string;
|
||||
filename?: string;
|
||||
}) => void;
|
||||
}
|
||||
}
|
||||
|
||||
export function reportLovableError(error: unknown, context: Record<string, unknown> = {}) {
|
||||
if (typeof window === "undefined") return;
|
||||
window.__lovableEvents?.captureException?.(
|
||||
error,
|
||||
{
|
||||
source: "react_error_boundary",
|
||||
route: window.location.pathname,
|
||||
...context,
|
||||
},
|
||||
{
|
||||
mechanism: "react_error_boundary",
|
||||
handled: false,
|
||||
severity: "error",
|
||||
},
|
||||
);
|
||||
// Prod React does not rethrow boundary-caught errors to window.onerror, so the
|
||||
// editor's telemetry never sees them. Forward to lovable.js's reporting hook,
|
||||
// which is present only inside the editor preview.
|
||||
// Loaders and server fns commonly throw a raw Response; String(it) is the
|
||||
// opaque "[object Response]", so pull out the status and URL instead.
|
||||
const message =
|
||||
error instanceof Response
|
||||
? `Response ${error.status}${error.url ? ` at ${error.url}` : ""}`
|
||||
: error instanceof Error
|
||||
? error.message
|
||||
: String(error);
|
||||
const stack = error instanceof Error ? error.stack : undefined;
|
||||
window.__lovableReportRuntimeError?.({
|
||||
message,
|
||||
...(stack !== undefined && { stack }),
|
||||
filename: window.location.pathname,
|
||||
});
|
||||
}
|
||||
+1
-15
@@ -7,10 +7,9 @@ import {
|
||||
HeadContent,
|
||||
Scripts,
|
||||
} from "@tanstack/react-router";
|
||||
import { useEffect, type ReactNode } from "react";
|
||||
import { type ReactNode } from "react";
|
||||
|
||||
import appCss from "../styles.css?url";
|
||||
import { reportLovableError } from "../lib/lovable-error-reporting";
|
||||
import { Toaster } from "@/components/ui/sonner";
|
||||
|
||||
|
||||
@@ -39,9 +38,6 @@ function NotFoundComponent() {
|
||||
function ErrorComponent({ error, reset }: { error: Error; reset: () => void }) {
|
||||
console.error(error);
|
||||
const router = useRouter();
|
||||
useEffect(() => {
|
||||
reportLovableError(error, { boundary: "tanstack_root_error_component" });
|
||||
}, [error]);
|
||||
|
||||
return (
|
||||
<div className="flex min-h-screen items-center justify-center bg-background px-4">
|
||||
@@ -81,16 +77,6 @@ export const Route = createRootRouteWithContext<{ queryClient: QueryClient }>()(
|
||||
{ name: "viewport", content: "width=device-width, initial-scale=1" },
|
||||
{ title: "Coleta de Caixas | Registro por código de barras" },
|
||||
{ name: "description", content: "Registre o início e o fim da coleta de caixas escaneando códigos de barras pela câmera do celular ou webcam." },
|
||||
{ name: "author", content: "Lovable" },
|
||||
{ property: "og:title", content: "Coleta de Caixas | Registro por código de barras" },
|
||||
{ property: "og:description", content: "Registre o início e o fim da coleta de caixas escaneando códigos de barras pela câmera do celular ou webcam." },
|
||||
{ property: "og:type", content: "website" },
|
||||
{ name: "twitter:card", content: "summary_large_image" },
|
||||
{ name: "twitter:site", content: "@Lovable" },
|
||||
{ name: "twitter:title", content: "Coleta de Caixas | Registro por código de barras" },
|
||||
{ name: "twitter:description", content: "Registre o início e o fim da coleta de caixas escaneando códigos de barras pela câmera do celular ou webcam." },
|
||||
{ property: "og:image", content: "https://pub-bb2e103a32db4e198524a2e9ed8f35b4.r2.dev/a9fd7eb4-4d53-47e8-99d9-f4ad53665e39/id-preview-01d939c3--d932967f-2b4a-4d36-bca0-997ad79943e9.lovable.app-1785503707518.png" },
|
||||
{ name: "twitter:image", content: "https://pub-bb2e103a32db4e198524a2e9ed8f35b4.r2.dev/a9fd7eb4-4d53-47e8-99d9-f4ad53665e39/id-preview-01d939c3--d932967f-2b4a-4d36-bca0-997ad79943e9.lovable.app-1785503707518.png" },
|
||||
],
|
||||
links: [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user