Add backward-compatible autoconfig support for Astro v5 and v4 projects#12938
Add backward-compatible autoconfig support for Astro v5 and v4 projects#12938dario-piotrowicz merged 9 commits intomainfrom
Conversation
🦋 Changeset detectedLatest commit: c4ba137 The changes in this PR will be included in the next version bump. 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 |
|
create-cloudflare
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-editor-shared
wrangler
commit: |
This comment was marked as outdated.
This comment was marked as outdated.
|
Codeowners approval required for this PR:
Show detailed file reviewers |
a896799 to
55ec991
Compare
Co-authored-by: ask-bonk[bot] <249159057+ask-bonk[bot]@users.noreply.github.com>
When tsconfig.json has no explicit 'include' field (common for Astro projects using "extends": "astro/tsconfigs/base"), adding an 'include' array with only worker-configuration.d.ts would override the parent config's includes, breaking type-checking. Instead, warn the user to manually add the entry when no existing 'include' field is found.
When an Astro config already has an import from @astrojs/cloudflare with a different local name (e.g. 'import adapter from "@astrojs/cloudflare"'), the autoconfig now correctly uses that identifier instead of hardcoding 'cloudflare'. This prevents generating broken config with undefined identifiers.
12435b0 to
46da614
Compare
petebacondarwin
left a comment
There was a problem hiding this comment.
LGTM - I tested it with an Astro 4 project, which worked, but I haven't tried out all the different permutations.
Thanks! 🫶 I manually tested it with Astro 4, 5 and 6. I didn't test all the different permutations either as there are a few however the code should be correct and if something were not to work as expected we can always fix that later 🙂🙏 |
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This PR updates autoconfig to support applications using Astro v5 and v4 while erroring on older versions of astro
npx <path-to-wrangler-built> setupnpm run previewand checked that the application is served correctlyA picture of a cute animal (not mandatory, but encouraged)