Easiest way to import modules


#1

Hi,

I have an meteor project that was started well before meteor 1.3 and the addition of es6 modules. It’s quite a large project now.

I was thinking about switching over to using modules rather than having everything global. The one thing that bothers me is that it would really slow down development if I continue as I am.

Adding a new dependency for a file requires me to find the exact dependency I need, how to import it, and then typing it out. Is there a quicker way to do all this?

If I were writing c# in visual studio for example, I know I could just right click when a module was missing from the top of the file, and it within two clicks it would be imported.

I currently use sublime for my meteor development. Is there a quicker way to import modules? Should I be using a full blown ide to be more efficient?


#2

I’m not familiar with Sublime, but I know there are several Atom packages that do this. For example:

If Atom packages exist, then similar Sublime packages probably do as well. If you want to go the IDE route, I believe you can also do this with WebStorm.


#3

Are you able to with WebStorm? I was not able to get it working, I was assuming this was due to WebStorm not recognizing importing requirements on a Meteor project.

If there’s a way to enable it I would be glad to hear!


#4

I could of sworn that I read some mention of this working with WebStorm, but now I’m not 100% sure. I’m not a regular WebStorm user, but I know a lot of people on this forum are. Hopefully someone else can enlighten us!


#5

I know WebStorm helps with file moving/renames, but I have not seen any features for imports - seems .js detection of imports is disabled in Meteor projects (by default, at least).

Hopefully there’s a way to turn it on! Although if there is, I wonder if it would even recognize the Meteor API. Prior to 1.3 imports were not required and WebStorm has not mentioned Meteor in any patch notes since then.