pages functions package.json

I have a cloudflare pages application that is connected to gitlab and deploys when I push. In this repo is a ./functions directory that contains a _middleware.js file that proxies all http requests to a node.js api if the pathname starts with /api.
I would like to use the twilio npm package like it does in this example https://github.com/Ryandev/cloudflare-worker-twilio-sms Where should I put this dependency? In the top-level package.json file at the root of the project or should I be putting in functions/package.json
GitHub
GitHub - Ryandev/cloudflare-worker-twilio-sms: Deploy SMS/Voice con...
Deploy SMS/Voice controller using cloudflare workers - GitHub - Ryandev/cloudflare-worker-twilio-sms: Deploy SMS/Voice controller using cloudflare workers
2 Replies
André
André11mo ago
I just created a new pages project that also has the ./functions folder. I added all npm packages to the root of the project and use webpack to package it appropriately to each function. Works fine.
kizzlebot
kizzlebot11mo ago
Can u possibly show me what that webpack.config.js file would look like?