js: Make requires in external modules correctly

Change-Id: If3829a048f6147e7c602053ba1d31fbbc2ffafdd