use the buildNum to bust require.js cache, fixes #1574

Use cache busting url param for requirejs module, and modify the order that things get replaced in the build so that the replaced index.html actually gets used.