Remove unnecessary cache interception options from configuration files#27
Merged
Remove unnecessary cache interception options from configuration files#27
Conversation
commit: |
There was a problem hiding this comment.
Pull request overview
This PR removes the enableCacheInterception and useAdapterOutputs configuration options and updates the build/runtime codepaths to behave as if cache interception and adapter outputs are always enabled.
Changes:
- Remove
enableCacheInterception/useAdapterOutputsfrom config types and from all example configs. - Make cache interception unconditional in routing, and always include cache-related overrides in middleware/edge bundles.
- Switch build flows (AWS + Cloudflare CLI) to rely on Next’s adapter outputs pipeline rather than the previous traced-files path.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/open-next/src/types/open-next.ts | Removes the two dangerous config options from the public type surface. |
| packages/open-next/src/core/routingHandler.ts | Makes cache interception run unconditionally for non-internal requests. |
| packages/open-next/src/build/middleware/buildNodeMiddleware.ts | Always includes cache-related overrides for external node middleware; removes conditional replacement plugin. |
| packages/open-next/src/build/edge/createEdgeBundle.ts | Removes includeCache option and always wires cache-related overrides. |
| packages/open-next/src/build/createServerBundle.ts | Removes non-adapter output path; always copies adapter output files. |
| packages/open-next/src/build/createMiddleware.ts | Stops passing includeCache into edge bundle creation. |
| packages/open-next/src/build/createAssets.ts | Assumes adapter-output layout for locating .next cache artifacts. |
| packages/open-next/src/build.ts | Always sets NEXT_ADAPTER_PATH and exits after next build, delegating bundling to the adapter. |
| packages/open-next/src/adapters/middleware.ts | Removes override markers and always initializes cache components in middleware adapter. |
| packages/cloudflare/src/cli/commands/build.ts | Always sets NEXT_ADAPTER_PATH; stops reading Wrangler config and changes build invocation signature. |
| packages/cloudflare/src/cli/build/open-next/createServerBundle.ts | Removes traced-files fallback; always copies adapter output files. |
| packages/cloudflare/src/cli/build/build.ts | Removes the non-adapter bundle generation pipeline; now only builds Next and logs. |
| packages/cloudflare/src/api/config.ts | Removes Cloudflare config option and defaults for cache interception / adapter outputs. |
| examples/pages-router/open-next.config.ts | Removes dangerous.enableCacheInterception / dangerous.useAdapterOutputs. |
| examples/experimental/open-next.config.ts | Removes dangerous.enableCacheInterception / dangerous.useAdapterOutputs. |
| examples/app-router/open-next.config.ts | Removes dangerous.enableCacheInterception / dangerous.useAdapterOutputs. |
| examples/app-pages-router/open-next.config.ts | Removes dangerous.enableCacheInterception / dangerous.useAdapterOutputs. |
| examples-cloudflare/e2e/pages-router/open-next.config.ts | Removes enableCacheInterception from Cloudflare config usage. |
| examples-cloudflare/e2e/experimental/open-next.config.ts | Removes enableCacheInterception from Cloudflare config usage. |
| examples-cloudflare/e2e/app-router/open-next.config.ts | Removes enableCacheInterception from Cloudflare config usage. |
| examples-cloudflare/e2e/app-pages-router/open-next.config.ts | Removes enableCacheInterception from Cloudflare config usage. |
Comments suppressed due to low confidence (1)
packages/open-next/src/build.ts:60
- There is now an unconditional
return;at line 55 which makes the entire “Generate deployable bundle” section below unreachable. If the adapter is the only supported build path now, consider deleting the dead code (and related imports) or replacing thereturnwith a conditional/feature flag so future readers don’t assume this code still runs.
return;
// Generate deployable bundle
printHeader("Generating bundle");
// Patch the original Next.js config
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
james-elicx
approved these changes
Mar 29, 2026
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.
Remove
enableCacheInterceptionanduseAdapterOutputs