umdjs / umd

UMD (Universal Module Definition) patterns for JavaScript modules that work everywhere.
MIT License
7.42k stars 423 forks source link

Checks for CommonJS module environments are not fail-safe #139

Open hjerabek opened 4 years ago

hjerabek commented 4 years ago

IMO, the CommonJS module environment checks coded here, i.e.

typeof module === 'object' && module.exports

will raise an exception if module==null. They should be changed to

typeof module === 'object' && module && module.exports
SimonHeimberg commented 2 years ago

You are right, it will raise an exception in this case. (I am wondering why the type of null is object, but this is how it is.) Is this case frequent?