CMS-2605 Implement require support in javascript. Circular dependencies are now handled.