Skip to content

Remove unnecessary cache interception options from configuration files#27

Merged
conico974 merged 2 commits intomainfrom
conico/remove-useless-options
Mar 29, 2026
Merged

Remove unnecessary cache interception options from configuration files#27
conico974 merged 2 commits intomainfrom
conico/remove-useless-options

Conversation

@conico974
Copy link
Copy Markdown
Contributor

Remove enableCacheInterception and useAdapterOutputs

Copilot AI review requested due to automatic review settings March 29, 2026 14:34
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 29, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@opennextjs/cloudflare@27
npm i https://pkg.pr.new/@opennextjs/aws@27

commit: 9bcf643

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 / useAdapterOutputs from 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 the return with 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.

@conico974 conico974 merged commit 606e853 into main Mar 29, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants