scotttrinh/angular-localForage

ReferenceError: module is not defined when used with node-webkit

Closed this issue · 5 comments

[94867:0820/103228:ERROR:nw_shell.cc(336)] ReferenceError: module is not defined at file://node_modules/angular-localforage/dist/angular-localForage.min.js:8:221

If I prepend this line with 'global.' it works as expected:

module.exports = factory(angular, require('localforage')); // Node/Browserify

to

global.module.exports = factory(angular, require('localforage')); // Node/Browserify

Should it check for module/global.module and use the right one?

Sure! Feel free to submit a PR, if you want to see this implemented. I didn't find any reference to global.module in the latest NW.js documentation, so maybe this is stale?

What is the status of this issue and its fix?
I just ran into the same issue, and the quick fix @ashleyhindle mentioned worked for me.

@bradtaniguchi Thanks for confirming that the aforementioned fixed worked for you. Honestly, I'm open to reviewing a PR, since I don't use NW.js. Are you interested/willing to submit a PR for this fix?

@scotttrinh
I'd love to open a PR for this issue. I plan on using NW.js and this add-on for a project of mine. So getting this fix would be great.

Thanks @bradtaniguchi for the PR. New version published to NPM and Bower this morning!