我們在進行微信小程序雲函數開發的時候,有時候不想本地安裝,可以直接通過添加依賴完成,雲函數會在雲端自動完成部署。
但是我們並不知道該庫的版本。
以tcb-router路由爲例,我們可以按照如下添加依賴
{
"name": "activity",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"mysql2": "^2.2.5",
"silly-datetime": "^0.1.2",
"tcb-router":"latest",
"wx-server-sdk": "^2.3.2"
}
}