Consider the following page:
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"></script>
</head>
<body>
<script data-main="app" src="require.js"></script>
</body>
</html>
How can I use jQuery as a dependency for RequireJS modules if it is not loaded with RequireJS? I know jQuery provides itself as an AMD global module, so I should be able to add it as a dependency, but I'm not really sure how to.
I would like to be able to do the following:
require(['jquery'], function() {
console.log('success')
});
And if jQuery hasn't finished loading yet, it should wait for completion and continue. Can this be done?
jquery
requirejs
dependencies
qwerty
source
to share