Last Updated: February 25, 2016
·
6.439K
· cgarvis

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.

4 Responses
Add your response

Thanks!

over 1 year ago ·

This is excellent. Thanks ;)

over 1 year ago ·

Thanks :)

over 1 year ago ·

Thank you!

over 1 year ago ·