From 4f44bd925edc2f39de1b0e288080bd751a9f5a71 Mon Sep 17 00:00:00 2001 From: Luis Angelo Belmonte Date: Wed, 22 May 2024 16:10:04 +0800 Subject: [PATCH] feat: support promise processor fn --- src/classes/child-processor.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/classes/child-processor.ts b/src/classes/child-processor.ts index 98ea85b0e5..cea4a7cf2c 100644 --- a/src/classes/child-processor.ts +++ b/src/classes/child-processor.ts @@ -28,7 +28,12 @@ export class ChildProcessor { let processor; try { const { default: processorFn } = await import(processorFile); - processor = processorFn; + + if (processorFn instanceof Promise) { + processor = await processorFn; + } else { + processor = processorFn; + } if (processor.default) { // support es2015 module.