Sharing code across apps in Meteor 1.3+


I am still on Meteor 1.2 and considering an update to 1.3/1.4. What I absolutely love about Meteor is the easy way to share common code across apps. For my set-up, I am using common packages stored in a central folder referenced by PACKAGE_DIRS. This works perfectly, and once I update on of these common packages, all apps refresh themselves, even if they are running at the very same time.

Now I read this section in the Meteor guide:

It does not mention sharing code this way anymore. The only options listed are git submodules (I am using Subversion for versioning), symbolic links (not a good idea since this causes problems when more than one developer is involved), and private npm packages (which cost a monthly fee and also mean that I would have to update my packages in every app).

What happened to my beloved PACKAGE_DIRS option, is this deprecated now?


Take a look at npm link and here’s a short tutorial. TBH, I have not yet used such a set up but I believe that’s the canonical solution in the npm world.


You could also set up a private npm registry for free on your machine.

There you could manage npm packages like they were online.

Take a look at sinopia, it’s super easy to set up.


If you’re interested in sticking with your current package approach (you don’t want to replace your internal packages with npm based packages), PACKAGE_DIRS will still work in 1.3/1.4. It’s possible that this approach might stop working at some point in the future, but I wouldn’t worry about it yet. When (if) it stops working, that means the current Troposphere (Atmosphere) based package approach will also stop working. I think we’re at least a few weeks out from having that happen … :slight_smile:.