and the former only works when I load the page directly and the latter only works with require.js