fixed relative paths for require.js

moved the require calls for require.js to be inside the define function so relative paths will work.