New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using URI inside a Firefox Add-on. #44

Closed
dtuite opened this Issue Aug 27, 2012 · 2 comments

Comments

Projects
None yet
2 participants
@dtuite

dtuite commented Aug 27, 2012

The Firefox extension environment uses CommonJS to require files. However, it isn't possible to use npm packages.

Basically that means that I have to place the src/uri.js file directly into my project and then require it like this:

// /lib/services/some_file.js

if (typeof exports !== 'undefined') {
  var URI = require('../uri');

  // Some tests to try and figure out wtf is going on..
  console.log("IS URI defined", typeof URI != 'undefined'); // true
  console.log("IS URI defined", URI instanceof Array);  // false
  console.log("IS URI defined", URI instanceof Function); // false
  console.log("IS URI defined", URI instanceof Object); // false 
  console.log("IS URI defined", URI.constructor == String); // false
  console.log("IS URI defined", URI.constructor == Number); // false 
  console.log("IS URI defined", URI.constructor == Boolean); // false
  console.log "IS URI defined", Object.prototype.toString.call(URI); // [object Object]
}


Whenever I try to use URI in the file (with ot without the new keyword) I get the following error:

TypeError: URI is not a function

Anyone got any idea what is going on? I'm using URI v1.7.1 and I've just upgraded from v1.5.0 which was working with this same setup.

@rodneyrehm

This comment has been minimized.

Show comment
Hide comment
@rodneyrehm

rodneyrehm Sep 14, 2012

Member

Maybe change that dependency handling stuff to UMD

Member

rodneyrehm commented Sep 14, 2012

Maybe change that dependency handling stuff to UMD

rodneyrehm added a commit that referenced this issue Nov 6, 2012

@rodneyrehm

This comment has been minimized.

Show comment
Hide comment
@rodneyrehm

rodneyrehm Nov 13, 2012

Member

Issue resolved with v1.8.0

Member

rodneyrehm commented Nov 13, 2012

Issue resolved with v1.8.0

@rodneyrehm rodneyrehm closed this Nov 13, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment