问题
I've an angular UI component project and another angular app which is consuming it. So every time if anything is changing on that package I need to do
npm uninstall --save @my-lib/package-one
and npm install --save @my-lib/package-one
Which is too time-consuming. I have tried npm link but it's not working.
Is there any other way in which I can achive this setup?
Using ng-packagr
for packaging and angular version 5.
EDIT 1 Also tried to use the approach explained in this video, but unfortunately it's not working. https://www.youtube.com/watch?v=Tw8TCgeqotg&feature=youtu.be
回答1:
Use npm link
:
cd your_package_one_dir # go into the package directory
npm link # creates global link
cd your_project # go into your project directory
npm link @my-lib/package-one # link-install the package
Any changes to your_package_one_dir
will be reflected in your_project/node_modules/@my-lib/package-one
. Note that the link should be to the package name, not the directory name for that package. See npm link
documentation.
来源:https://stackoverflow.com/questions/49771724/setting-angular-package-development-setup