Hello friends,
At work we’ve moved to a Meteor package based approach. By default, VS Code doesn’t know that when you import ... from 'meteor/package-name'
that it is possibly a reference to a file in /packages
. It also doesn’t know how to look for api.mainModule
entries in a Package.js
file. However, VS Code does let you map this kind of thing in jsconfig.json
like this:
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"meteor/package-name": [
"packages/package-name/lib/client/main.js",
"packages/package-name/lib/server/main.js"
]
}
}
}
Problem is that this is a bit tedious for something that feels like it should come out of the box.
So, I created an extension, with a single command that does exactly this.
https://marketplace.visualstudio.com/items?itemName=mattblack.meteor-package-intellisense
https://github.com/mattblackdev/meteor-package-intellisense
Just run the command:
Meteor Package IntelliSense
and it will go through your /packages folders, find the Package.js for each and wire up the mainModule entries to your jsconfig.json
compilerOptions.paths
value.
Next steps for me and anyone who wants to contribute, will be to add a setting for METEOR_PACKAGE_DIRS
. For projects like VulcanJS this will be really handy. Then I’d also like to find out where meteor downloads atmosphere packages and do the same thing.
Hope this helps some folks! Enjoy!