You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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:Whenever I try to use URI in the file (with ot without the
new
keyword) I get the following error: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.
The text was updated successfully, but these errors were encountered: