## Symptom
Grafana's \`app-crash-log\` alert fires on every deploy. The Loki query
that backs it (\`ERR_|FATAL|uncaughtException|…\`) matches:
Error [ERR_MODULE_NOT_FOUND]: Cannot find module
'/app/apps/journal/app/lib/logger.server' imported from
'/app/apps/journal/app/lib/email.server.ts'
A real bug, not a false positive: \`email.server.ts\` line 2 was
\`import { logger } from \"./logger.server\"\` — no extension.
## Why typecheck didn't catch it
\`tsconfig.base.json\` sets \`moduleResolution: \"bundler\"\`. The bundler
resolver accepts extensionless relative imports because Vite / esbuild
/ webpack resolve them at build time. TypeScript was happy.
Production runs \`node --experimental-strip-types server.ts\`, which
uses Node's NodeNext ESM resolver — strict about extensions. The two
resolvers disagree silently for files Node loads directly (server.ts,
\`.server.ts\` modules dynamically imported from it, and jobs).
## Fix
1. **Added \`.ts\` extensions to the 4 broken imports** I could find:
- \`apps/journal/app/lib/email.server.ts\` → \`./logger.server.ts\`
(the actual deploy-blocker)
- \`apps/planner/app/lib/brouter.ts\` → \`./route-merge.ts\`, \`./http.server.ts\`
- \`apps/planner/app/lib/use-nearby-pois.ts\` → \`./overpass.ts\`
- \`packages/map/src/MapView.tsx\` → \`./layers.ts\` (caught by the rule)
2. **Added \`eslint-plugin-import-x\` with \`import-x/extensions: always\`**,
scoped to files Node actually executes raw:
- \`apps/*/server.ts\`
- \`apps/*/app/lib/**/*.server.ts\`
- \`apps/*/app/jobs/**/*.ts\`
- \`packages/*/src/**/*.{ts,tsx}\`
Ignored: route-scoped \`*.server.ts\` files (bundled by Vite into the
React Router build, never loaded by Node), and test files (Vitest's
own resolver).
## What's still possible
- Non-\`.server.ts\` files in \`app/lib\` (e.g. \`legal.ts\`, \`actor-iri.ts\`)
could still ship extensionless imports. They're not in the lint
scope. If one breaks at runtime we can extend the glob — for now
they tend to be tiny utility modules that don't import other
relatives.
- The deeper fix would be \`moduleResolution: nodenext\` for server-side
tsconfig, or bundling the server code so Node never sees raw \`.ts\`.
Bigger surgery; the lint rule covers the failure mode for now.
Full repo: pnpm typecheck / lint / test all green after \`pnpm install\`.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
94 lines
2.9 KiB
JSON
94 lines
2.9 KiB
JSON
{
|
|
"name": "trails.cool",
|
|
"private": true,
|
|
"description": "Collaborative route planning + federated activity sharing for outdoor enthusiasts",
|
|
"type": "module",
|
|
"license": "MIT",
|
|
"packageManager": "pnpm@10.33.0",
|
|
"engines": {
|
|
"node": ">=20"
|
|
},
|
|
"scripts": {
|
|
"dev": "turbo dev",
|
|
"build": "turbo build",
|
|
"lint": "turbo lint",
|
|
"test": "turbo test",
|
|
"test:watch": "vitest",
|
|
"test:e2e": "playwright test",
|
|
"test:e2e:ui": "playwright test --ui",
|
|
"typecheck": "turbo typecheck",
|
|
"db:push": "drizzle-kit push --config packages/db/drizzle.config.ts --force",
|
|
"db:migrate-data": "tsx packages/db/src/migrate-data.ts",
|
|
"db:studio": "drizzle-kit studio --config packages/db/drizzle.config.ts",
|
|
"db:seed": "node --experimental-strip-types scripts/seed.ts",
|
|
"dev:services": "docker compose -f docker-compose.dev.yml up -d",
|
|
"dev:full": "./scripts/dev.sh",
|
|
"dev:reset": "./scripts/reset-dev.sh",
|
|
"dev:ios": "pnpm --filter @trails-cool/mobile ios",
|
|
"dev:android": "pnpm --filter @trails-cool/mobile android",
|
|
"openspec": "openspec"
|
|
},
|
|
"pnpm": {
|
|
"overrides": {
|
|
"picomatch@>=4.0.0 <4.0.4": "4.0.4",
|
|
"brace-expansion@>=4.0.0 <5.0.5": "5.0.5",
|
|
"path-to-regexp@<0.1.13": "0.1.13",
|
|
"lodash@<4.18.1": "4.18.1",
|
|
"react": "catalog:",
|
|
"react-dom": "catalog:"
|
|
},
|
|
"onlyBuiltDependencies": [
|
|
"@sentry/cli",
|
|
"esbuild"
|
|
]
|
|
},
|
|
"devDependencies": {
|
|
"@eslint/js": "^10.0.1",
|
|
"@expo/fingerprint": "^0.19.2",
|
|
"@fission-ai/openspec": "^1.3.1",
|
|
"@playwright/test": "^1.60.0",
|
|
"@react-router/dev": "catalog:",
|
|
"@react-router/node": "catalog:",
|
|
"@react-router/serve": "catalog:",
|
|
"@sentry/vite-plugin": "^5.3.0",
|
|
"@tailwindcss/vite": "catalog:",
|
|
"@testing-library/jest-dom": "^6.9.1",
|
|
"@testing-library/react": "^16.3.2",
|
|
"@types/geojson": "^7946.0.16",
|
|
"@types/leaflet": "^1.9.21",
|
|
"@types/react": "catalog:",
|
|
"@types/react-dom": "catalog:",
|
|
"drizzle-kit": "catalog:",
|
|
"drizzle-orm": "catalog:",
|
|
"drizzle-postgis": "catalog:",
|
|
"eslint": "^10.4.0",
|
|
"eslint-config-prettier": "^10.1.8",
|
|
"eslint-plugin-import-x": "^4.16.2",
|
|
"fit-file-parser": "^3.0.0",
|
|
"i18next": "^26.2.0",
|
|
"i18next-browser-languagedetector": "^8.2.1",
|
|
"jsdom": "^29.1.1",
|
|
"leaflet": "^1.9.4",
|
|
"linkedom": "^0.18.12",
|
|
"playwright": "^1.60.0",
|
|
"postgres": "catalog:",
|
|
"prettier": "^3.8.3",
|
|
"react": "catalog:",
|
|
"react-dom": "catalog:",
|
|
"react-i18next": "^17.0.8",
|
|
"react-leaflet": "^5.0.0",
|
|
"react-router": "catalog:",
|
|
"tailwindcss": "catalog:",
|
|
"turbo": "^2.9.14",
|
|
"typescript": "catalog:",
|
|
"typescript-eslint": "^8.59.4",
|
|
"vite": "catalog:",
|
|
"vitest": "^4.1.7"
|
|
},
|
|
"version": "1.0.0",
|
|
"dependencies": {
|
|
"expo": "~55.0.24",
|
|
"react": "19.2.0",
|
|
"react-native": "0.83.4"
|
|
}
|
|
}
|