Setting angular package development setup

帅比萌擦擦* 提交于 2019-12-13 02:30:23

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!