Merged AMD/CommonJS dispatch to use sync 'require'

Merged AMD/CommonJS dispatch to both use sync 'require'.

Fixes #298.


P.S. This needs to be rebased once PR #311 is merged. Till then, you can just look at the 2nd commit.