Requirejs and external scripts
Snippet of code showing off loading external non-amd scripts:
requirejs.config({
paths: {
'stripe': 'https://js.stripe.com/v1/?1'
},
shim: {
'stripe': {
exports: 'Stripe'
}
}
});
You can get around requirejs auto adding ".js" to scripts by giving it query parameter which you can see in the snippet.
Written by Christopher Garvis
Related protips
4 Responses

Thanks!
over 1 year ago
·

This is excellent. Thanks ;)
over 1 year ago
·

Thanks :)
over 1 year ago
·

Thank you!
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Amd
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#