Main.js optimization