fix(journal,planner): resolve pino-pretty to an absolute path in dev #279
No reviewers
Labels
No labels
dependencies
major
security-pin
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
trails-cool/trails!279
Loading…
Reference in a new issue
No description provided.
Delete branch "fix-journal-pino-pretty-dev"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
pnpm devserves 500s for every Journal (and Planner) request:pino resolves a bare transport target with
createRequire()from its caller's file (util.getCallSites). Vite's SSR module runner evaluateslogger.server.tswithout a script name, so the call sites pino sees are[caller.js, pino.js, ""]. pino drops its own two frames, leaving only"", and resolution fails. Reproduced on Node 22, 24 and 26 and onmain; not related to #278.Fix
In both loggers, resolve the target via
createRequire(import.meta.url).resolve("pino-pretty"). pino uses absolute targets as-is. This only runs outside production, wherepino-pretty(a devDependency) is installed.Verification
pnpm typecheckpassespnpm lintpassespnpm testpasses🤖 Generated with Claude Code