fix: mac-oui-lookup ESM/CJS interop crash on startup
CI / web (push) Successful in 17s
CI / api (push) Successful in 23s

Named import of a CommonJS module's export crashed the whole process
at boot (SyntaxError, not caught by tsc since it's a runtime module
resolution behavior, not a type error). Verified by actually running
the built output with node this time instead of trusting tsc alone.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-12 23:04:52 -06:00
parent 1caad69448
commit d614be4747
+6 -1
View File
@@ -1,6 +1,11 @@
import type { FastifyInstance, FastifyReply, FastifyRequest } from "fastify";
import type Database from "better-sqlite3";
import { getVendor } from "mac-oui-lookup";
// mac-oui-lookup is CommonJS; Node's ESM interop doesn't reliably expose its
// named exports (crashed the whole process on startup with
// "Named export 'getVendor' not found" despite working fine under
// require()) -- import the default and destructure instead.
import macOuiLookup from "mac-oui-lookup";
const { getVendor } = macOuiLookup;
import { getRecentDevices, setDeviceLabel, clearDeviceLabel, type DeviceRow } from "../db/index.js";
async function requireAuth(req: FastifyRequest, reply: FastifyReply) {