Skip to content
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
Closed

Using URI inside a Firefox Add-on. #44

dtuite opened this issue Aug 27, 2012 · 2 comments

Comments

@dtuite
Copy link

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
Copy link
Member

Maybe change that dependency handling stuff to UMD

rodneyrehm added a commit that referenced this issue Nov 6, 2012
@rodneyrehm
Copy link
Member

Issue resolved with v1.8.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants