"require" not working properly in nightlies.

RESOLVED INCOMPLETE

Status

RESOLVED INCOMPLETE
3 years ago
a year ago

People

(Reporter: g.litenstein, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

3 years ago
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Firefox/45.0
Build ID: 20160315153207

Steps to reproduce:

Working with an SDK add-on, have two files, 

// a.js
------------
let foo = { 
bar: function () {}
}
exports.foo = foo;

and
// b.js
------------
let { foo } = require("foo");
foo.bar();


Actual results:

TypeError: foo.bar is not a function.

If instead I do,

// a.js
------------
let foo = { 
bar: function () {}
}
exports.foo = foo;

and
// b.js
------------
let foo = require("foo").foo;
foo.bar(); // Works!


Expected results:

The first approach should have worked fine, as it does on the stable builds.
Component: Untriaged → General
Product: Firefox → Add-on SDK
Version: 48 Branch → unspecified
(Reporter)

Comment 1

3 years ago
I have received user reports that the same error is appearing in 45.0.1 on Windows.



Firefox 45.0
Enabled Plugins: Keybinder(1.2.41), TabGroups(1.0.2),

    [Browser Console (Click on "Shortcut Mappings"):]

keybinder:
TypeError: Windows is undefined
Stack trace:
@resource://gre/modules/commonjs/toolkit/loader.js -> resource://keybinder-at-fail-dot-cl/lib/prefs/prefpane.js:170:1
emitOnObject@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/event/core.js:112:9
emit@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/event/core.js:89:38
buttonClick@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/simple-prefs.js:22:3
Observer<.observe@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/system/events.js:81:7
oncommand@about:addons:1:1

    [Browser Console (Firfox startup):]

19:20:56.224 keybinder:Object { stack: "", 5 more… }1 runner.js:166
fileName: "..../prefs/prefpane.js"
lineNumber: 76
message:"parentmenu is null"
stack: "MenuItem@resource://..se-backend.js:746:1"
toString:load/<.toString.value()
proto:TypeError

19:20:56.226 keybinder:Object { stack: "", 5 more… }1 Promise-backend.js:936
fileName: "..../prefs/prefpane.js"
lineNumber: 76
message:"parentmenu is null"
stack: "MenuItem@resource://..se-backend.js:746:1"
toString:load/<.toString.value()
proto:TypeError
https://bugzilla.mozilla.org/show_bug.cgi?id=1399562
Status: UNCONFIRMED → RESOLVED
Last Resolved: a year ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.