diff --git a/lib/compiler/schemalBuilder.js b/lib/compiler/schemalBuilder.js index 5884fcb..114ed5e 100644 --- a/lib/compiler/schemalBuilder.js +++ b/lib/compiler/schemalBuilder.js @@ -244,6 +244,7 @@ function resolveCompiledImportPath(sourceFilePath, outputFilePath, importPath, p return importPath; } if (sourceFilePath.startsWith("node_modules")) { + // 如果是node_modules下的文件,保持原有的处理逻辑 return importPath.startsWith('.') ? (relative ? path_1.default.join(relative, importPath).replace(/\\/g, '/') : path_1.default.join('..', importPath).replace(/\\/g, '/')) : importPath; diff --git a/lib/types/Configuration.d.ts b/lib/types/Configuration.d.ts index af58436..4086d7b 100644 --- a/lib/types/Configuration.d.ts +++ b/lib/types/Configuration.d.ts @@ -56,6 +56,7 @@ export type ServerConfiguration = { socket?: (ctx: Koa.ParameterizedContext, any>) => { url: string; } | undefined; + middleware?: Koa.Middleware[] | ((app: Koa) => Koa.Middleware[]); }; /** * 前后台访问配置 diff --git a/src/types/Configuration.ts b/src/types/Configuration.ts index 6157fcb..26dc342 100644 --- a/src/types/Configuration.ts +++ b/src/types/Configuration.ts @@ -57,6 +57,7 @@ export type ServerConfiguration = { internalExceptionMask?: string; koaBody?: IKoaBodyOptions, // koa-body配置 socket?: (ctx: Koa.ParameterizedContext, any>) => { url: string } | undefined; + middleware?: Koa.Middleware[] | ((app: Koa) => Koa.Middleware[]); // 自定义中间件 }; /**