设置角度包开发设置 [英] Setting angular package development setup

查看:98
本文介绍了设置角度包开发设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个角度UI组件项目和另一个正在使用它的角度应用程序.因此,每当包装上发生任何变化时,我都需要做

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-onenpm install --save @my-lib/package-one

这太耗时了.我已经尝试过npm链接,但是它不起作用.

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?

使用ng-packagr进行打包和发布版本5.

Using ng-packagr for packaging and angular version 5.

编辑1 还尝试使用此视频中介绍的方法,但很遗憾,此方法不起作用. https://www.youtube.com/watch?v=Tw8TCgeqotg& feature = youtu.be

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

推荐答案

使用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

your_package_one_dir的任何更改都将反映在your_project/node_modules/@my-lib/package-one中.请注意,链接应指向软件包名称,而不是该软件包的目录名称.请参阅npm link 文档.

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.

这篇关于设置角度包开发设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆