WebStorm - Unresolved function or method

WebStorm 2017.1
Build #WS-171.3780.79, built on March 17, 2017
JRE: 1.8.0_112-release-736-b13 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Mac OS X 10.12.4

Im working with with in a node.js project and am getting unresolved function or method warnings in the ide. My understanding is that I should not be getting this if the npm package is installed in the project node_modules folder but i get them anyway. I try install via the Preferences/Libraries and Frameworks to no avail.

I also tried invalidating cache and restarting but that also did not work. Screenshot below: Note the error "Unresolved Type DedupePlugin". How do I get my types registered in the system? Thank you

7 comments

Plugin modules are exported in the following way in webpack:

function exportPlugins(exports, path, plugins) {
    plugins.forEach(function(name) {
        Object.defineProperty(exports, name, {
            configurable: false,
            enumerable: true,
            get: function() {
                return require(path + "/" + name);
            }
        });
    });
}

exportPlugins(exports, ".", [
    "DefinePlugin",
    "NormalModuleReplacementPlugin",
...
]);


such dynamically generated modules can hardly be resolved during static analysis.

workaround is using typescript stubs (Preferences | Languages & Frameworks | JavaScript | Libraries, Download.., choose 'webpack');

1

Webpack is not an option on that path. See screenshot. I guess you are referring to webpack 2 for the syntax? I will check it.

0

>Webpack is not an option on that path. See screenshot

 

Please try upgrading to 2017.1.1 - https://youtrack.jetbrains.com/issue/WEB-26160 is fixed there

0

I have the latest update. 



0

Nice the answer fix my problem. Thanks @Elena Pogorelova

1

Nice the answer fix my problem. Thanks @Elena Pogorelova

0

Please sign in to leave a comment.