fix(build): keep the server logger out of client bundles
CI / check (push) Successful in 33s
CI / tests-imaging-browsers (push) Successful in 1m50s
CI / tests-integration (push) Successful in 2m28s
CI / tests-unit (push) Successful in 3m6s
CI / tests-quality (push) Successful in 1m40s
CI / tests-ui (push) Successful in 5m56s
CI / preflight (push) Skipped
CI / deploy (push) Successful in 3m58s
CI / check (push) Successful in 33s
CI / tests-imaging-browsers (push) Successful in 1m50s
CI / tests-integration (push) Successful in 2m28s
CI / tests-unit (push) Successful in 3m6s
CI / tests-quality (push) Successful in 1m40s
CI / tests-ui (push) Successful in 5m56s
CI / preflight (push) Skipped
CI / deploy (push) Successful in 3m58s
The production webpack build failed with UnhandledSchemeError: client components imported @/lib/logger, which binds pino, AsyncLocalStorage (node:async_hooks), node:crypto and node:fs — and validates server env on import. The UI fixture aliased those modules, so the harness and tests never hit it. - add src/lib/browser-log.ts: browser-safe logger with the same interface; errors are forwarded to /api/diagnostics/errors via reportBrowserError - guard src/lib/logger.ts with server-only and drop its now-dead browser branches - switch the 11 client components/hooks to @/lib/browser-log Verified with the Dockerfile's production build (pnpm run build) and the full vitest suite.
This commit is contained in:
1 parent
fb470123c3
commit
c15177a52e
13 files changed
+71
-42
No files matched your search
@@ -45,8 +45,8 @@ import {
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
import { useServerAction } from "@/hooks/use-server-action";
|
||||
import { adminFetch } from "@/lib/admin-fetch";
|
||||
import { logger } from "@/lib/browser-log";
|
||||
import { invalidateSongPickerCache } from "@/lib/client-cache/song-picker-cache";
|
||||
import { logger } from "@/lib/logger";
|
||||
import { parseTraxChannels } from "@/lib/trax-format";
|
||||
import { TraxPlayer } from "./trax-player";
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ import { Loader2, Play, Square } from "lucide-react";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import { toast } from "sonner";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { logger } from "@/lib/logger";
|
||||
import { logger } from "@/lib/browser-log";
|
||||
import { TRAX_TICK_SECONDS, type TraxChannel } from "@/lib/trax-format";
|
||||
|
||||
const TICK_SECONDS = TRAX_TICK_SECONDS;
|
||||
|
||||
Reference in new issue
Block a user