您可以将某个依赖项指定为包含某个包的任何本地目录。此功能对本地脱机开发和测试很有帮助。要通过 UI 设置本地路径,请参阅安装本地包。
路径引用始终以 file:
前缀开头,并且始终使用正斜杠 (/
) 作为路径分隔符。
You can use either absolute paths, or paths that are relative to the Project manifest root. In other words, a path preceded with two dots (..
) refers to the root of the Project path (for example, <project path>/my-package
).
对于 Windows 绝对路径,file:
前缀后面是驱动器盘符和冒号(通常为 C:
),除此之外,其他部分与 Linux 或 MacOS 路径相同。
{
"dependencies": {
"my_local_package": "file:/Users/johndoe/Packages/my_local_package"
}
}
{
"dependencies": {
"my_local_package": "file:C:/Users/johndoe/Packages/my_local_package"
}
}
{
"dependencies": {
"my_local_package": "file:../test/my-test-package"
}
}