mardi 31 janvier 2017

Library imported manually but it's dependencies aren't available ember.js

I have a javascript library "c-liberator" that I need to use in my Ember application I have imported it manually as it's not a npm or bower package but its dependencies aren't being included, when I try to use one of its functions I get this error

Uncaught TypeError: md5 is not a function

I tried importing the exact md5 module that "c-liberator" uses and If I use it in a function in application.js it works fine so the md5 module works fine it's just that "c-liberator" is not using it.

The code below runs fine in application.js but throws the uncaught type error in "c-liberator"

var creds = md5('username' + ':' + 'pass');

I have also tried installing the md5 library one at a time with bower and npm and confirmed it was referenced by bower.json and package.json, this didn't change anything.

The minified md5 library is in c-liberator/libmd5.min.js and I have also tried putting into ember-cli-build.js which didn't work either

app.import('vendor/c-liberator/c-liberator.js', {
    amdModule: 'clib'
  });
  app.import('vendor/c-liberator/lib/md5.min.js', {
    amdModule: 'md5'
  });

Any help would be really appericated.

Thanks Hamish




Aucun commentaire:

Enregistrer un commentaire