Skip to content

Fix Vite pre-optimizing for internal helper picomatch copy - #17489

Open
jimpala wants to merge 4 commits into
withastro:mainfrom
jimpala:feature/cloudflare-picomatch-prebundle
Open

Fix Vite pre-optimizing for internal helper picomatch copy#17489
jimpala wants to merge 4 commits into
withastro:mainfrom
jimpala:feature/cloudflare-picomatch-prebundle

Conversation

@jimpala

@jimpala jimpala commented Jul 23, 2026

Copy link
Copy Markdown

Fix Cloudflare pre-optimizing for internal helpers' picomatch dependency

Issue & Repro

  • See my repro
  • pnpm why picomatch shows that @astrojs/internal-helpers has its own copy of picomatch which isn't in the optimizeDeps list
  • This copy can then cause the dev server to fail a la Astro 6 beta + cloudflare + react + SSR breaks build #15796 because picomatch uses CJS require() internally
  • Running pnpm dev --force on the repro gives the following error locally, stemming from the internal helper copy of picomatch:
require is not defined
  Stack trace:
    at runInRunnerObject (workers/runner-worker/index.js:107:3)
    at null.<anonymous> (workers/runner-worker/index.js:350:37)
 ELIFECYCLE  Command failed with exit code 1.

Changes

  • This quick fix therefore adds 'astro > @astrojs/internal-helpers > picomatch' to the optimizeDeps list in packages/integrations/cloudflare/src/index.ts

https://github.com/jimpala/astro/blob/0dfbee95759900b33deeb6498e127a262bc4e5f9/packages/integrations/cloudflare/src/index.ts#L331-L332

Testing

  • Haven't added any further tests - the existing test for picomatch preoptimizing is in packages/integrations/cloudflare/test/with-react.test.ts

Docs

  • No docs added, this is fix is tiny

@github-actions github-actions Bot added the pkg: integration Related to any renderer integration (scope) label Jul 23, 2026
@changeset-bot

changeset-bot Bot commented Jul 23, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c810feb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 40 packages
Name Type
@astrojs/cloudflare Patch
@test/astro-cloudflare-node-prerender-mdx Patch
@test/astro-cloudflare Patch
@test/astro-cloudflare-allowed-hosts Patch
@test/astro-cloudflare-astro-dev-platform Patch
@test/astro-cloudflare-astro-env Patch
@test/astro-cloudflare-binding-image-service Patch
@test/astro-cloudflare-cache-provider-wait-until Patch
@test/astro-cloudflare-cache-provider Patch
@test/astro-cloudflare-client-address Patch
@test/astro-cloudflare-compile-custom-image-service Patch
@test/astro-cloudflare-compile-image-service Patch
@test/astro-cloudflare-custom-entryfile Patch
@test/astro-cloudflare-dev-image-endpoint Patch
@test/astro-cloudflare-external-image-service Patch
@test/astro-cloudflare-external-redirects Patch
@test/astro-cloudflare-internal-redirects Patch
@test/astro-cloudflare-no-output Patch
@test/astro-cloudflare-prerender-node-env Patch
@test/astro-cloudflare-prerender-queue-consumers Patch
@test/astro-cloudflare-prerender-styles Patch
@test/astro-cloudflare-prerenderer-errors Patch
@test/astro-cloudflare-prerenderer-render-error Patch
@test/routing-priority-cloudflare Patch
@test/cf-server-entry Patch
@test/astro-cloudflare-server-island-prerender-framework Patch
@test/astro-cloudflare-sessions Patch
@test/astro-cloudflare-sql-import Patch
@test/cf-ssr-deps Patch
@test/astro-cloudflare-static Patch
@test/astro-cloudflare-svelte-rune-deps Patch
@test/astro-cloudflare-top-level-return Patch
@test/cf-user-optimize-deps Patch
@test/astro-cloudflare-vite-plugin Patch
@test/astro-cloudflare-with-base Patch
@test/astro-cloudflare-with-react Patch
@test/astro-cloudflare-with-solid-js Patch
@test/astro-cloudflare-with-svelte Patch
@test/astro-cloudflare-with-vue Patch
@test/astro-cloudflare-wrangler-preview-platform Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: integration Related to any renderer integration (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant