We don't have any official docs on doing custom builds. The closest thing to doing what you want is a series of posts available from the Utah AGRC.
We are working on addressing this. Early next year we're planning to release a web app we're calling the JS API Web Optimizer. I don't want to share a ton of detail yet but the idea is you tell us which modules you're using (provide a URL to your app for us to crawl, upload your zipped source code, upload a list of module identifiers or manually select the modules you want) and we'll generate a custom JS API build for you (the app will also bundle custom modules you've written as long as they're AMD compatible). You can then download your custom build and host it yourself or you can select an option for us (esri) to host it for you on js.arcgis.com. An ArcGIS.com organizational or developer will be required to use this app.
Hm.. I don´t know if "JS Web Optimizer" is a way I will go.. This sounds all like "sign in with your ArcGIS Online account and we will host your code in the cloud" ... What is if I don´t want to share my code?
But thank you for the link. Maybe this workaround is a way to go.
I just completed a boilerplate example using ASP.NET Web API, Dojo and ArcGIS API for JavaScript. There is a section on building JavaScript code using local Dojo modules and the ESRI CDN. You can get the synopsis of this boilerplate/tutorial at https://github.com/yinshi/WebApi-Dojo-ArcgisApi-Boilerplate/wiki
The example provides instructions on building REST services using ASP.NET Web API, but you can skip the server section if you are only interested in the client side.