Aakash N S
Aakash N S
CDCloudflare Developers
Created by Paolo of Lost Pages on 1/18/2024 in #pages-help
change pages functions watch directories in wrangler
Thanks, I've done the same! Didn't realize that might work. 😅
5 replies
CDCloudflare Developers
Created by Paolo of Lost Pages on 1/18/2024 in #pages-help
change pages functions watch directories in wrangler
From the source code of wrangler, it does look like it only watches the functions directory: https://github.com/cloudflare/workers-sdk/blob/main/packages/wrangler/src/pages/dev.ts#L433 (thanks @pc) However, I was able to use chokidar-cli and concurrently to watch for changes in another source directory (called shared in my project), and touch one of the files inside functions to trigger a rebuild. Here's what the scripts sections of my package.json looks like:
"scripts": {
"wrangler": "npx wrangler@latest pages dev public",
"tailwind": "npx tailwindcss -i ./shared/styles.css -o ./public/styles.css --watch",
"chokidar": "npx chokidar-cli \"./shared/**/*.{js,jsx,ts,tsx}\" -c \"touch ./functions/ping.js\"",
"dev": "npx concurrently --handle-input --success first --kill-others --raw \"npm run chokidar\" \"npm run wrangler\" \"npm run tailwind\""
}
"scripts": {
"wrangler": "npx wrangler@latest pages dev public",
"tailwind": "npx tailwindcss -i ./shared/styles.css -o ./public/styles.css --watch",
"chokidar": "npx chokidar-cli \"./shared/**/*.{js,jsx,ts,tsx}\" -c \"touch ./functions/ping.js\"",
"dev": "npx concurrently --handle-input --success first --kill-others --raw \"npm run chokidar\" \"npm run wrangler\" \"npm run tailwind\""
}
NOTE: I'm also using Tailwind CSS to watch and rebuild styles.
5 replies
CDCloudflare Developers
Created by Paolo of Lost Pages on 1/18/2024 in #pages-help
change pages functions watch directories in wrangler
were you able to figure out a solution to this?
5 replies