Skip to content

jsonapi-datastore does not work with requirejs #20

@theirishpenguin

Description

@theirishpenguin

I'm using jsonapi-datastore (master branch at commit 12dc63e) via requirejs and I have to implement the following workaround to get it to work in jsonapi-datastore/dist/jsonapi-datastore.js...

if ( typeof define === "function" && define.amd ) {                             
  define(function (require, exports, module) {                                  
    module.exports = {                                                          
      JsonApiDataStore: JsonApiDataStore,                                       
      JsonApiDataStoreModel: JsonApiDataStoreModel                              
    };                                                                          
  });                                                                           
}

This hack is based on http://stackoverflow.com/a/29655291.

I'm not sure if this is the best solution to this problem so I haven't put it in a PR. Would adding this block to the end of jsonapi-datastore.js make sense?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions