build main.js correctly when it is not in a subfolder
removed trailing whitespace
remove console.log statement
fix loading a root main.js according to Tony's suggestions