Meteor: Possible to reference a local package whil

2019-08-12 19:26发布

I have a local package that I am writing. I wanted to extend some functionality from a few of the core meteor packages. In order to do this, I was creating another local package.

So now local package A is attempting to use local package B. But even after adding the symlink to package A's packages folder, I get an unknown package error when running test-packages.

meteor add local-package-b

Doesn't work because meteor complains: You're not in a Meteor project directory

Is this even possible or do I need to publish to atmosphere first? I wanted to keep the additional package local as it's going to be a handful of helper methods.

I've double checked the name in package B's package.js file and it matches with my api.use in package A's package.js file.

标签: meteor
1条回答
爷的心禁止访问
2楼-- · 2019-08-12 19:52

Symlinks shouldn't be necessary here. Local packages are found by checking:

  1. Anything under the directory pointed to by the environment variable PACKAGE_DIRS.
  2. Anything under the packages directory in the current application directory.
  3. Core packages.

As long as your two packages reside in one of those three locations, the should be found. Also see my article on local packaes for more details on (1).


Based on our conversation below, the main issue had to do with the approach to creating a new package. While it's being written, it's necessary that a package be added to (or tested by) an app. Here are the steps I take when working on a shared, local package:

  1. Create a new app.
  2. meteor create --package mypackage
  3. meteor add mypackage
  4. Finish writing and testing the package.
  5. Move mypackage under my PACKAGE_DIRS directory so it will be available to other apps.
查看更多
登录 后发表回答