Added try catch for when requirejs is undefined