我們的項目依賴第三方庫時,會在package.json這樣記錄
"dependencies": {
"xbossdebug-web": "^1.0.0"
"xbossdebug-web": "~1.0.0"
}
下面是關于^和~符號stackoverflow的解釋
In the simplest terms, the tilde matches the most recent minor version (the middle number). ~1.2.3 will match all 1.2.x versions but will miss 1.3.0.
如果設置~1.2.3時,會下載1.2.3到1.2.9中存在的最新版本,但是不會下載1.3.0版本
The caret, on the other hand, is more relaxed. It will update you to the most recent major version (the first number). ^1.2.3 will match any 1.x.x release including 1.3.0, but will hold off on 2.0.0.
如果設置^1.2.3時,會下載1.2.3到1.9.9中存在的最新版本,但是2.0.0就不會被下載