y4vk_q
Last Updated: February 25, 2016
·
4.216K
· cgarvis
51d3be13a400e1ea8cdae57f866e9c11

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.

Say Thanks
Respond

4 Responses
Add your response

11023
F54f1980fe7515d4924dff9287b7b83b

Thanks!

over 1 year ago ·
13828
Eightbit 6ef192f7 305a 4018 8bf5 5b72f12c2a35 normal

This is excellent. Thanks ;)

over 1 year ago ·
14820
5f07e4deb795e84d028287d5d6238de4

Thanks :)

over 1 year ago ·
17907
None

Thank you!

over 1 year ago ·