browserify/webworkify

Cannot read property 'default' of undefined (module that exports 'undefined'?)

nickygerritsen opened this issue · 2 comments

It seems that there might be a case when a module exports nothing, that webworkify crashes, but I'm not sure if this is really the problem.

For me this seems to happen at some index.
If I understand the code correctly the indices are the numbers in the generated javascript and in that case it seems https://github.com/videojs/videojs-contrib-ads exports "undefined" for me.

In that case the check at line 19 fails because exp === undefined.

If I add

if (!exp) {
    continue;
}

Before that check, it seems to work correctly.

Is this a good fix? If so I can create a PR.

This should have been fixed by #21. @nickygerritsen can you confirm?

Yup looks good!