Skip to content

Commit

Permalink
fix(framework): support esm environment for debug gui http routes
Browse files Browse the repository at this point in the history
  • Loading branch information
marcj committed Oct 12, 2023
1 parent c5642fa commit 5cb33cf
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/framework/src/debug/http-debug.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@

import { registerStaticHttpController } from '@deepkit/http';
import { AppModule, findParentPath } from '@deepkit/app';
import { dirname } from 'path';
import { getCurrentFileName } from '@deepkit/core';

export function registerDebugHttpController(module: AppModule<any>, path: string): void {
const localPath = findParentPath('node_modules/@deepkit/framework-debug-gui/dist/framework-debug-gui', __dirname);
const currentDir = dirname(getCurrentFileName());
const localPath = findParentPath('node_modules/@deepkit/framework-debug-gui/dist/framework-debug-gui', currentDir);
if (localPath) {
registerStaticHttpController(module, {path, localPath, groups: ['app-static'], controllerName: 'FrameworkDebuggerController'});
registerStaticHttpController(module, { path, localPath, groups: ['app-static'], controllerName: 'FrameworkDebuggerController' });
} else {
console.log('Warning: node_modules/@deepkit/framework-debug-gui no build found in ' + __dirname);
console.log('Warning: node_modules/@deepkit/framework-debug-gui no build found in ' + currentDir);
}
}

0 comments on commit 5cb33cf

Please sign in to comment.