fix jsRequireTree helper function to correctly work with prepended and appended scripts from a folder