[js] Switching to a somewhat sensical requirejs loading pattern. Still a work in progress.