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

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

Closed
ashleyhindle opened this issue Aug 20, 2015 · 5 comments · Fixed by #131
Closed

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

ashleyhindle opened this issue Aug 20, 2015 · 5 comments · Fixed by #131

Comments

@ashleyhindle
Copy link

[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?

@scotttrinh
Copy link
Owner

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?

@scotttrinh scotttrinh added this to the 1.3.0 milestone Jun 19, 2016
@scotttrinh scotttrinh removed this from the 1.3.0 milestone Jun 27, 2016
@bradtaniguchi
Copy link
Contributor

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.

@scotttrinh
Copy link
Owner

@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?

@bradtaniguchi
Copy link
Contributor

@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.

bradtaniguchi added a commit to bradtaniguchi/angular-localForage that referenced this issue Jan 3, 2017
Now the factory assignment for localforage is applied to
`global.modules.exports` instead of `modules.exports` if `module` is
undefined.
`module` is undefined in an NW.js environment (for whatever
reason). So now we check for module and we uses global if `module`
is undefined. Otherwise we proceed as before.

Thank @ashleyhindle for fix.

Fixes scotttrinh#77
@scotttrinh
Copy link
Owner

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

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

Successfully merging a pull request may close this issue.

3 participants