Repository navigation
Conversation
…t in dev In dev mode, deleting or renaming an injected route's entrypoint caused createRoutesList to reject with ENOENT when reading prerender exports, resulting in an unhandled rejection that crashed the server under adapters without unhandledRejection handlers (such as @astrojs/cloudflare) and halted route updates. - Catch ENOENT when reading route entrypoint in createRoutesList under dev mode and log a warning instead of throwing. - Wrap rebuildRoutes in vite-plugin-routes with try/catch to prevent unhandled rejections from file watcher events. - Added unit tests for missing injected entrypoints in both dev mode and build mode. Fixes withastro#18325 Co-Authored-By: Claude Code <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 4b9993d The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
Merging this PR will not alter performance
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
createRoutesList()reads route component content for prerender options and encountersENOENT(e.g. when an integration injected route points to a file that was deleted or renamed during dev), catch the error and log a warning instead of throwing, allowing other routes to continue rebuilding and functioning normally.rebuildRoutes()withinvite-plugin-routes, wrap the route rebuild in a try/catch block to ensure watcher event listeners do not emit unhandled promise rejections.astro.Fixes #18325
Testing
packages/astro/test/units/routing/manifest.test.ts:in dev mode, does not throw when an injected route entrypoint does not existin build mode, throws when an injected route entrypoint does not exist./node_modules/.bin/astro-scripts test "test/units/routing/*.test.ts" --strip-types) with 100% pass rate.pnpm run typecheck).Docs
Bug fix only; does not change public documentation or API surface.
🤖 Generated with Claude Code