Reinstate check for typeof `require` == "function"

This is still an imperfect test for the presence of CommonJS, but
at least it will not attempt to call `require` if it doesn't exist.
Merge pull request #475 from artsyca/issue/471

Reinstate check for typeof `require` == "function"