Autocompletion and IIFE modules
I'm frequently using Immediately Invoked Function Expressions (IIFE) to define modules in my code of the form;
foo.js
module.exports = (function () {
function foo(data) {
}
return {
foo: foo
}
}());
bar.js
var foo = require('./foo');
module.exports = (function () {
function bar(data) {
foo.foo(data) <--- foo.foo marked as a ReferenceError
}
return {
bar: bar
}
}());
So the foo module is exporting the function foo, however, Webstorm does not properly resolve references to the function when I use it in other modules. This has been a little frustrating as I really like this form of module defintion. I've been searching to find a way to allow Webstorm to resolve these references, but have not had any luck. Has someone else run into this who can help me. Thanks.
Please sign in to leave a comment.
Logged as https://youtrack.jetbrains.com/issue/WEB-17747, please vote for it to be notified on any progress