Meteor does not load my local package automatically


#1

I do a meteor create --package my_package and add some code into my_package/foo.js. Then meteor add my_package. In .meteor/packages, my_package is being added to the list. But when I run meteor --verbose, Meteor does not load my_package. What’s going on here?

Thanks


#2

In your package you have created the package.js file? And in it you have added the file foo.js?


#3

I’m assuming you want to add a local package to your app, rather than one sourced from atmosphere?

Once you have set up your package code, you need to do the following. Note that “my_name” will usually be your Meteor developer account name:

If it does not already exist, create a packages folder at the top level of your app:

cd myapp
mkdir packages

Then, within the packages folder, create a link to your actual package directory. This should use the absolute path reference:

cd packages
ln -s /absolute/path/to/my_name:my_package my_name:my_package
      \_________actual location _________/ \_ package name _/

Add the package to your app:

meteor add my_name:my_package

Check it worked

meteor list
my_name:my_package      1.0.1+ Your package information
iron:router             1.0.7  Routing specifically designed for Meteor
meteor-platform         1.2.1  Include a standard set of Meteor packages in your app
meteorhacks:async       1.0.0  Set of async utilities to work with NPM modules

+ These packages are built locally from source.

Note the line at the end, and the corresponding flagged package.


#4

@Peppe_LG meant that you should use api.addFiles to add foo.js as in api.addFiles('foo.js'). Do this inside the Package.onUse block of package.js.