We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
option.require
1 parent 95f2f52 commit 7000e15Copy full SHA for 7000e15
lib/worker/base.js
@@ -181,8 +181,15 @@ const run = async options => {
181
} else if (Array.isArray(ref)) {
182
const [path, options] = ref;
183
184
- const mod = await load(path);
185
- mod.apply(null, ...options);
+ const loadedModule = await load(path);
+
186
+ if (typeof loadedModule === 'function') {
187
+ loadedModule.apply(null, ...options);
188
+ } else if (typeof loadedModule.default === 'function') {
189
+ loadedModule.default.apply(null, ...options);
190
+ } else {
191
+ channel.send({type: 'non-invokable-require-option'});
192
+ }
193
}
194
195
0 commit comments