Skip to content

fix(cloudflare): declare esbuild as runtime dependency - #1353

Open
uttkarsh-26 wants to merge 1 commit into
opennextjs:mainfrom
uttkarsh-26:fix/1339-esbuild-dependency
Open

fix(cloudflare): declare esbuild as runtime dependency#1353
uttkarsh-26 wants to merge 1 commit into
opennextjs:mainfrom
uttkarsh-26:fix/1339-esbuild-dependency

Conversation

@uttkarsh-26

@uttkarsh-26 uttkarsh-26 commented Aug 23, 2026

Copy link
Copy Markdown

Fixes #1339

Problem
@opennextjs/cloudflare imports esbuild at build time (src/cli/build/bundle-server.ts, src/cli/build/open-next/*.ts) but declared it only in devDependencies. Consumers only resolved it via hoisting from @opennextjs/aws (0.25.4), which breaks when the hoist slot is claimed (e.g. @vitejs/plugin-react optional peer) and leaves npm ci with extraneous: true.

Approach

  • Move esbuild: catalog: from devDependencies to dependencies in packages/cloudflare/package.json (catalog already ^0.27.0).
  • Add regression test build-deps.spec.ts that asserts dependencies.esbuild is defined (TDD: RED before fix, GREEN after).
  • Add changeset patch.

Tests

  • RED: build-deps.spec.ts fails with expected undefined to be defined before fix (1 failed, 342 passed).
  • GREEN: 343/343 passed, 35 files after fix.
  • pnpm -C packages/cloudflare lint:check and ts:check pass (import sorted).

Risk
Low. No runtime behavior change; only ensures published package carries its build-time dependency.


Open in Devin Review

esbuild is imported at build time (bundle-server.ts, open-next/*)
but was only in devDependencies. Consumers only got it via
hoisting from @opennextjs/aws, which breaks under npm ci and
when the hoist slot is claimed (e.g. vite optional peer).

Add esbuild to dependencies (catalog) and add regression test.

Fixes opennextjs#1339
@changeset-bot

changeset-bot Bot commented Aug 23, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 8c34479

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

This PR includes changesets to release 1 package
Name Type
@opennextjs/cloudflare Patch

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

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

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.

esbuild is imported at build time but not declared as a dependency — works only by hoisting accident, breaks under npm ci

1 participant