Added a condition to make sure `require` is defined before using it

This is because sometimes exports is defined but that doesnt
necessarily mean that require is also defined; Lumbar for example, also
uses exports, but does not use require
Merge pull request #101 from liorch88/verify-require-defined

Added a condition to make sure `require` is defined before using it