WebStorm, Meteor, and “Unresolved Function”

WebStorm, a JavaScript IDE that I think is just wonderful, added Meteor support in its new version 9. However, I’ve found a rather annoying problem: When you import a Meteor package, like Iron Router, the IDE doesn’t recognize the members of the imported library. When you look at code using the new library, say a line that says Router.map, you’ll see it flagged as an error like “Unresolved function or method map()”.

Meteor stores the packages that it’s using in its .meteor directory and has a list of them in .meteor/packages as plain text. It turns out that you can make WebStorm recognize all the imported packages by opening the .meteor directory in WebStorm’s editor, and clicking the “Import packages as library” link in the top left:

Import Packages

Problem solved!