How to post-process Functions bundle to integrate with Sentry

I need to upload Functions bundle’s source map to Sentry + post-process both the bundle and its source map to inject Sentry’s debug-id
https://docs.sentry.io/platforms/javascript/sourcemaps/uploading/cli/#3-inject-debug-ids-into-artifact

AFAIU I need to do the following:

  1. use wrangler pages functions build --sourcemap to generate the bundle and its source map.
  2. do the necessary post-processing of the generated files
  3. rename the bundle file to _worker.js and put it into the ./dist folder (output folder for all static files)
  4. run wrangler pages deploy ./dist command to deploy Pages. It will ignore ./functions folder and use _worker.js file instead.

Questions:

  1. Is my approach correct?
  2. Any pitfalls?
  3. What about routing? In my case Cloudflare won’t automatically generate routes based on the ./functions structure. What’s the effect?
  4. Does it worth documenting such a use case? It’s not a trivial workflow and the wrangler pages functions build is not documented at all.

Anyone?