Fix require order for JS files