From 8adeea60db655c1fbe36d1bca93d94cb846a730c Mon Sep 17 00:00:00 2001 From: Manuel Astudillo Date: Fri, 23 Sep 2022 14:00:51 +0200 Subject: [PATCH] fix(service): construct dir to dashboard files --- packages/service/src/index.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/service/src/index.ts b/packages/service/src/index.ts index 4127e75..26af7dc 100644 --- a/packages/service/src/index.ts +++ b/packages/service/src/index.ts @@ -39,8 +39,11 @@ export async function startServer(port: number = 4567, serveDashboard = false) { const versionString = `Nandu NPM Registry v${pkg.version}`; if (serveDashboard) { - const { distDir } = require("@nanduland/dashboard"); - app.use(express.static(distDir)); + const path = require("path"); + const dashboardDistDir = path.resolve( + `${getPkgJsonDir()}/../dashboard/dist` + ); + app.use(express.static(dashboardDistDir)); } else { app.get("/", (req: Request, res: Response) => { res.status(200).send(versionString);