This is minimal reproduction of an issue when running sentry with sveltekit using the cloudflare adapter, building for cloudflare pages. The reproduction uses cloudflare's wrangler pages dev command to trigger the error locally, but the same error occurs when deploying to cloudflare pages (cloudflare pages prevents the upload as a result of the issue).
The sentry setup is not "correct"/"complete" in the example, to illustrate the entry point for the issue (which appears to be the initCloudflareSentryHandle function in src/hooks.server.js).
pnpm install
pnpm run wrangler-dev(wrangler-dev is a wrapper around vite build and wrangler pages dev)
When running wrangler-dev the following error is thrown:
⛅️ wrangler 4.20.0
───────────────────
✘ [ERROR] Build failed with 1 error:
✘ [ERROR] Could not resolve "minimatch"
../output/server/chunks/hooks.server.js:24793:34:
24793 │ globMatcher = require("minimatch").minimatch;
╵ ~~~~~~~~~~~
You can mark the path "minimatch" as external to exclude it from the bundle, which will
remove this error and leave the unresolved path in the bundle. You can also surround this
"require" call with a try/catch block to handle this failure at run-time instead of
bundle-time.
✘ [ERROR] Failed to build _worker.js.This appears to be a result of a dependency on @fastify/otel that is not being correctly bundled: https://github.com/fastify/otel/blob/cef7fa5fd4726a1b6479dde726fa55ed3b1bd08c/index.js#L79 possibly related to isaacs/minimatch#257