npm 云函数_如何在Netlify函数中使用npm软件包

npm 云函数

Initialize a package.json file in the root folder of your project:

在项目的根文件夹中初始化package.json文件:

npm init -y

Then install any npm package you need, for example:

然后安装所需的任何npm软件包,例如:

npm install axios

A node_modules folder and a package-lock.json file will be created. Commit both (yes, you need to add the node_modules content to the repository you want to deploy, try to keep your dependencies as few as possible)

将创建一个node_modules文件夹和package-lock.json文件。 两者都提交(是的,您需要将node_modules内容添加到要部署的存储库中,并尽量减少依赖项)

That’s it. You can now access those npm packages using require() in your Netlify Functions.

而已。 现在,您可以在Netlify函数中使用require()访问这些npm软件包。

翻译自: https://flaviocopes.com/netlify-functions-npm-packages/

npm 云函数

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值