Improved requirejs insertion to prevent useless code in built result