From ed4c8b28da90ffdce9c31d798148c4bcc23b673f Mon Sep 17 00:00:00 2001 From: Alan Bridgeman Date: Thu, 8 Jan 2026 15:48:38 -0600 Subject: [PATCH] Changed from equire to import. As import is the more ESM native way --- src/Router.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Router.ts b/src/Router.ts index 4ea5ad6..3916604 100644 --- a/src/Router.ts +++ b/src/Router.ts @@ -87,7 +87,12 @@ export class Router { } // Load the file as a module - const controllerModule = require(controllerPath); + const moduleNamespace = await import(controllerPath); + + // When you import() a file, you get a "Module Namespace Object". + // If the file used 'module.exports = Class' or 'export default Class', + // your class is now inside the '.default' property. + const controllerModule = moduleNamespace.default || moduleNamespace; logMessage(`${controllerPath} loaded successfully: ${JSON.stringify(Object.keys(controllerModule))} exports found.`, LogLevel.DEBUG);