aws / aws-sdk-mobile-analytics-js

Amazon Mobile Analytics JavaScript SDK
Apache License 2.0
82 stars 38 forks source link

Usage with requireJS? #20

Closed johnborges closed 7 years ago

johnborges commented 7 years ago

Is there a recommended way to use this SDK with requireJS?

johnborges commented 7 years ago

After some testing I came up with this:

requirejs.config({
    baseUrl: "js/",
    // path mappings for module names not found directly under baseUrl
    paths: {
        aws: 'libs/aws-sdk',
        ama: 'libs/aws-sdk-mobile-analytics'
    },
    // non-AMD scripts
    shim: {
        'aws': {
            exports: 'AWS'
        },
        'ama': {
            deps: ['aws'],
            exports: 'AMA'
        }
   }
  });