Skip to content

Narrow optimizeDeps.include glob to JS files only in Cloudflare adapter - #18091

Merged
matthewp merged 1 commit into
mainfrom
factory/fix-18090
Sep 22, 2026
Merged

matthewp merged 1 commit into
mainfrom
factory/fix-18090

Conversation

@astro-factory

@astro-factory astro-factory Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Changes

  • Changes the optimizeDeps.include glob in the Cloudflare adapter's configEnvironment hook from 'astro/runtime/**' to 'astro/runtime/**/*.js'. Vite expands the glob against astro's exports map ("./runtime/*": "./dist/runtime/*"), which previously matched all 166 files in dist/runtime/ — including 83 .d.ts declaration files. Each .d.ts became an esbuild entry that produced an empty chunk, adding ~83 unnecessary optimizer entries and ~78 zero-byte files per environment on every cold optimize run.
  • With the narrowed glob, .d.ts files are excluded entirely. Optimizer entry counts drop from 209 → 126 (deps_astro) and 806 → 723 (deps_ssr); all 83 runtime .js modules remain pre-bundled and pages render correctly.

Testing

  • Added packages/integrations/cloudflare/test/units/optimize-deps-glob.test.ts, a unit test that verifies the glob in optimizeDeps.include matches only .js files and excludes .d.ts entries.

Docs

  • No docs update needed — this is a dev-server performance fix with no user-facing API or behavior change.

Closes #18090

@changeset-bot

changeset-bot Bot commented Sep 21, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7ddac50

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

This PR includes changesets to release 1 package
Name Type
@astrojs/cloudflare 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

@github-actions github-actions Bot added the pkg: integration Related to any renderer integration (scope) label Sep 21, 2026
@matthewp
matthewp merged commit 28d59a9 into main Sep 22, 2026
27 checks passed
@matthewp
matthewp deleted the factory/fix-18090 branch September 22, 2026 00:56
@astrobot-houston astrobot-houston mentioned this pull request Sep 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix verified Reporter confirmed the triage bot fix works pkg: integration Related to any renderer integration (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@astrojs/cloudflare: astro/runtime/** in optimizeDeps.include pre-bundles every .d.ts in astro/dist/runtime

1 participant