Reputation: 1567
I have a module that I'm using elsewhere, but I keep getting "module is not defined." It works if I use the global directive but that implies that the module is defined elsewhere. Is there any way to fix this issue? Thank you
In module.js
/* exported module */
var module = (function($){
...
return {method: method};
})($);
$(module.method);
In foo.js
var foo = function() {
function bar() {
module.method();
}
};
$(foo);
Upvotes: 5
Views: 2650
Reputation: 93
We get this error whenever we "use strict";
mode in Node.js
project. Just add the given below option in your .jshintrc
file to fix it:
{
"node": true
}
This way jshint will know you are working in Node.js
environment.
Upvotes: 2
Reputation: 4119
In my case didn't work, thus, I injected next piece of code:
/* globals module: false */
Upvotes: 3
Reputation: 7552
You can also do the following in your jshint.rc
"jshint_options":
{
"globals": {
"module": false
}
}
Upvotes: 2