y4vk_q
Last Updated: February 25, 2016
·
4.818K
· 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

11023

Thanks!

over 1 year ago ·
13828

This is excellent. Thanks ;)

over 1 year ago ·
14820

Thanks :)

over 1 year ago ·
17907

Thank you!

over 1 year ago ·