Skip to content

Commit

Permalink
refactor: handle loaded module
Browse files Browse the repository at this point in the history
  • Loading branch information
sculpt0r committed Mar 27, 2023
1 parent 7fe1622 commit 7223a74
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/worker/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,10 @@ const run = async options => {
const loadedModule = await load(path);

if (typeof loadedModule === 'function') {
await loadedModule.apply(...options);
await loadedModule(...options);
} else if (typeof loadedModule.default === 'function') {
await loadedModule.default.apply(...options);
const { default: fn } = loadedModule;
await fn(...options);
} else {
channel.send({type: 'non-invokable-require-option'});
}
Expand Down

0 comments on commit 7223a74

Please sign in to comment.