Where to place functions with custom build configuration? / Static Forms Plugin not working
Hey, I'm trying to use the static forms plugin (https://developers.cloudflare.com/pages/functions/plugins/static-forms/) and in theory I just need to add a
/functions/_middleware.ts
file, but I'm not sure where they should be. I have the attached build configuration, but should I create the functions
directory in /
, /frontend
, or /frontend/build
?
In any case, trying it locally with npx wrangler pages dev build
(running in /frontend
and after npm run build
ing manually) seems to find the _middleware.ts
file in /frontend/functions
because it fails to build if I don't have the plugin npm installed.
However, even though it is supposedly building the function, it doesn't really do anything - when I visit the website, the form still has data-static-form-name
and its method/action attributes has not been overwritten.
Would appreciate a pointer on what I'm doing wrong. Thanks in advance!2 Replies