Improved library build option to work reasonalby well with both RequireJS projects and standalone.