Do AMD detection before CommonJS to work around conflict with AngularMocks

Since AngularMocks defines a global variable named "module", it will
force Bacon into thinking it's running inside a CommonJS context, not
AMD
Merge pull request #349 from zoomzoom83/AngularMocksConflict

Do AMD detection first to work around conflict with AngularMocks