【发布时间】:2017-08-22 01:45:49
【问题描述】:
当拥有不同的代码库时,我将如何在它们之间共享代码。 所有代码都在打字稿中并在持续开发中。
我正在寻找一个简单的解决方案。
我尝试过的事情:
1 使用导入语句和其他项目的路径:
import { type } from '../../otherProj/src/type';
不起作用:
error TS2307: Cannot find module '../../otherProj/src/type'
2 npm 模块
使用本地安装
npm i ../otherProj
这是有问题的,因为我总是必须在每次更改时更新库的版本,或者我必须手动卸载/重新安装库。
3 git 子模块/子树
使用 git 子模块。
4 软链接/目录连接
由于我们在 Windows 上,我们现在使用 mklink /D /J
还有其他选择吗?
【问题讨论】:
标签: git typescript npm