package.json 的詳細原版說明之 本地路徑庫引用
阿新 • • 發佈:2018-11-23
https://docs.npmjs.com/files/package.json
裡面有介紹到 dep 的 file 欄位。
文件裡面找到更詳細的介紹如下:
https://docs.npmjs.com/files/package.json#local-paths
Local Paths
s of version 2.0.0 you can provide a path to a local directory that contains a package. Local paths can be saved using npm install -S
or npm install --save
../foo/bar
~/foo/bar
./foo/bar
/foo/bar
in which case they will be normalized to a relative path and added to yourpackage.json
. For example:
{
"name": "baz",
"dependencies": {
"bar": "file:../foo/bar"
}
}
This feature is helpful for local offline development and creating tests that require npm installing where you don't want to hit an external server, but should not be used when publishing packages to the public registry.