We had a similar issue when trying to build a custom webpart using JS; the code would not execute when Minimal Download Strategy (MDS) was turned on.
As it turns out, SharePoint seems to be smart enough to look for <script> tags with type="text/javascript", and disable MDS when required on a specific page.
So we added a .html file to SiteAssets, let's say /sites/mysite/SiteAssets/test.html. And added some content to it:
<script type="text/javascript">
console.log("test");
</script>
Then we added a Content Editor Web Part to the page, with a link to the file.
When clicking on "Home," the page is at first loaded with MDS, but then redirects to the actual .aspx when it discovers the <script>.
So, no need to deactivate MDS when specifying type="text/javascript". Without this, the code loads through MDS and does not execute. Lesson learned.
sp.jsis indeed coming down when the page is published. – James Love Feb 26 '13 at 17:10