Updated to match the UMD pattern from the link in the comment, because requirejs was failing to optimise it how it was.