How to change the default directory for Cloudflare functions?

Is it possible to change the default directory for Cloudflare functions? I want /src/functions instead of /functions, but I don’t know how to change it.

I don’t think you can change the default directory. You could try changing the root directory to /src and see if that works. It will also require all of your building to happening the /src/ folder.

2 Likes

Right that is actually the right solution! Thanks

Hm I tried to change the directory like this, but it doesn’t work:

wrangler pages dev ./src

Is there another way to change the root dir?

Wild guess, but what about removing the leading slash?

You would need to run wrangler in the src folder. We look for functions where the command is ran.

So just wrangler pages publish . in the src folder.

3 Likes