Let the import throw error instead

This commit is contained in:
Fang-Pen Lin
2025-11-14 21:28:43 -08:00
parent f5936cad7e
commit fbaf8d37a3

View File

@@ -8,14 +8,10 @@ import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { AuthMode } from "@app/services/auth/auth-type";
export const registerBddNockRouter = async (server: FastifyZodProvider) => {
const importNock = async () => {
const importNock = () => {
// Notice: it seems like importing nock somehow increase memory usage a lots, let's import it lazily.
// eslint-disable-next-line import/no-extraneous-dependencies
const nock = await import("nock");
if (!nock) {
throw new InternalServerError({ message: "Failed to import nock" });
}
return nock;
return import("nock");
};
const checkIfBddNockApiEnabled = () => {