Skip to content

Commit bbc59d7

Browse files
committed
refactor: handle loaded module
1 parent fa567e3 commit bbc59d7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/worker/base.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,10 @@ const run = async options => {
184184
const loadedModule = await load(path);
185185

186186
if (typeof loadedModule === 'function') {
187-
await loadedModule.apply(...options);
187+
await loadedModule(...options);
188188
} else if (typeof loadedModule.default === 'function') {
189-
await loadedModule.default.apply(...options);
189+
const {default: fn} = loadedModule;
190+
await fn(...options);
190191
} else {
191192
channel.send({type: 'non-invokable-require-option'});
192193
}

0 commit comments

Comments
 (0)