[英]TypeScript: import { X } from 'Y' - how to substitute/redirect Y
I have an external library Y which is installed using npm
and loaded from node_modules
. 我有一个外部库Y,它使用
npm
安装并从node_modules
加载。 It resides on GitHub. 它位于GitHub上。 This is how I'm using it:
这就是我的使用方式:
import { X } from 'Y';
I did a fork of Y and checked-out to a local folder/local git repository. 我做了一个Y叉,并检出到本地文件夹/本地git存储库。
Now, I would like to use this local source code instead of an npm package. 现在,我想使用此本地源代码代替npm软件包。 I dont want to modify my
imports
. 我不想修改我的
imports
。 Is there a way how to do that? 有办法吗? I'm using TypeScript and angular-cli.
我正在使用TypeScript和angular-cli。
Use npm link
- https://docs.npmjs.com/cli/link 使用
npm link
- https://docs.npmjs.com/cli/link
It is a perfect and simple solution, no need to use file:
references. 这是一个完美而简单的解决方案,无需使用
file:
引用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.