Skip to content

feat(plugin-nextjs): add opt-in Turbopack support#1456

Draft
dmiller1-godaddy wants to merge 1 commit into
godaddy:mainfrom
dmiller1-godaddy:AIROBUILD-3903-turbopack-nextjs
Draft

feat(plugin-nextjs): add opt-in Turbopack support#1456
dmiller1-godaddy wants to merge 1 commit into
godaddy:mainfrom
dmiller1-godaddy:AIROBUILD-3903-turbopack-nextjs

Conversation

@dmiller1-godaddy

Copy link
Copy Markdown

Summary

Adds opt-in Turbopack handling to @gasket/plugin-nextjs while preserving the existing Webpack behavior by default.

Next.js 16 defaults to Turbopack, but the plugin currently relies on a Webpack callback and NormalModuleReplacementPlugin rules for server-only Gasket files. Consumers can now set TURBOPACK=1 alongside the Next CLI --turbopack flag.

Changes

  • Adds a nextConfig hook gated by TURBOPACK=1.
  • Removes the plugin's Webpack callback only in Turbopack mode.
  • Adds @gasket/core and loaded @gasket/plugin-* / @*/gasket-plugin-* packages to serverExternalPackages.
  • Preserves and deduplicates consumer-provided server externals.
  • Documents the opt-in behavior and app-owned alias/fallback responsibilities.
  • Adds a minor changeset and regression coverage.

Validation

  • pnpm --filter @gasket/plugin-nextjs test: 167 tests passed.
  • Package lint passed with six pre-existing lib/index.d.ts warnings.
  • Package typecheck passed.
  • pnpm --filter @gasket/plugin-nextjs build passed; 17 CJS files generated.
  • Direct config probes confirmed:
    • default mode returns the original config with Webpack intact;
    • TURBOPACK=1 removes Webpack and adds deduplicated Gasket server externals.

Downstream validation

This behavior was exercised in a Next.js 16.2.6 App Router application using Turbopack, including server routes, Presentation Central, and a full browser smoke test. The downstream integration remains opt-in; app-specific Webpack aliases/fallbacks still need equivalent turbopack.resolveAlias configuration.

Co-authored-by: Claude <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Jul 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 866092b

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

This PR includes changesets to release 1 package
Name Type
@gasket/plugin-nextjs Minor

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

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.

1 participant