Skip to content

fix: move esbuild from devDependencies to dependencies#69

Open
tduong-godaddy wants to merge 1 commit into
godaddy:mainfrom
tduong-godaddy:fix/move-esbuild-to-dependencies
Open

fix: move esbuild from devDependencies to dependencies#69
tduong-godaddy wants to merge 1 commit into
godaddy:mainfrom
tduong-godaddy:fix/move-esbuild-to-dependencies

Conversation

@tduong-godaddy

Copy link
Copy Markdown

Problem

The published npm package (@godaddy/cli versions 0.5.1, 0.5.2, 0.5.3) is broken for users who don't have esbuild installed locally. When running any command (including godaddy --version), users encounter:

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'esbuild' imported from .../cli.js

Root Cause

  1. Runtime dependency: esbuild is imported in src/services/extension/bundler.ts
  2. Loaded at startup: This import is transitively loaded through:
    • src/cli-entry.ts imports applicationCommand
    • src/cli/commands/application.ts imports from core/applications
    • src/core/applications.ts imports from services/extension/bundler
  3. Marked as external: build.mjs marks esbuild as external (not bundled)
  4. Wrong dependency type: esbuild was in devDependencies, not dependencies

Since devDependencies are not installed when users install the package from npm, the CLI fails immediately on any command.

Why Some Users Could Use It

The CLI worked for users who happened to have esbuild installed:

  • In their project's node_modules (for their own build process)
  • Installed globally

Node.js module resolution finds esbuild in parent directories, masking the packaging bug.

Solution

Move esbuild from devDependencies to dependencies so it's always installed with the CLI package.

Testing

Before fix (with esbuild not available):

npm install -g @godaddy/cli@0.5.3
godaddy --version
# Error: Cannot find package 'esbuild'

After fix:

npm install -g esbuild  # Install esbuild to test workaround
godaddy --version
# Works correctly

With this PR, esbuild will be installed automatically with the CLI.

Impact

This fix will allow all users to use the CLI without requiring a separate esbuild installation, fixing the broken 0.5.x releases.

esbuild is imported at runtime in src/services/extension/bundler.ts
and transitively loaded on CLI startup via src/core/applications.ts.

Because it was in devDependencies, it was not installed when users
installed @godaddy/cli from npm, causing ERR_MODULE_NOT_FOUND errors
on all commands including --version.

The CLI only worked for users who happened to have esbuild installed
in their project or globally, making this a silent packaging bug.

This fix ensures esbuild is always available at runtime.

Fixes versions: 0.5.1, 0.5.2, 0.5.3

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

@llessa-godaddy llessa-godaddy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Needs changeset. Otherwise PR is ✅

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.

2 participants