main.js optimization #1