问题
So, my problem is that I am trying to add a couple of console.log() to a js file of an already installed package that I have in my project.
The package that I am trying to add these lines to is aldeed:autoform
, since I've discovered kind of a bug in a function and I want to contribute with a solution.
In order to modify a package, I have already done the following steps:
- Clone the github repo for autoform inside
myProject/packages/
folder. - Modified the lines that I wanted to.
- Changed the name value inside
Package.describe({})
(set toaldeed-autoform-modified
) - Removed
aldeed:autoform
from my project (meteor remove aldeed:autoform
) - Added my modified version of autoform (
meteor add aldeed:autoform-modified
)
The problem is that, since I am also using antoher packages that have aldeed:autoform
as a dependency, this package gets automatically installed, and then when I run my project, it trhows an error saying that a template (related to AutoForm) is defined twice, and this makes sense since autoform package and the modified one have this templated defined, and both get included in the project.
What should I do? What is the proper way to modify a package that is a dependency for others?
回答1:
If you want to modify an existing package, you can use a local version of it.
There is no need to modify its name, and if another package depends on it, changing the name will cause the dependent package not to use your modified version.
Simply clone the package repository into your projects's/packages
directory or to the directory denoted by the METEOR_PACKAGE_DIRS
environment variable.
You can find more details on the Meteor Guide.
来源:https://stackoverflow.com/questions/42178852/how-to-modify-package-that-is-dependency-of-other-packages-meteorjs