Skip to content

Published npm package (dist/cli.mjs) contains invalid JS syntax — all CLI commands fail with SyntaxError #592

Description

@krishna-ivk

Description

Installing command-code from npm and running any CLI command produces a SyntaxError — the published build artifact dist/cli.mjs line~2 has mangled import statements with missing required whitespace tokens.

Steps to reproduce

$ npm i -g command-code
$ commandcode --version

Expected behavior

The CLI should start normally (e.g. print version and exit).

Actual behavior

Exit code 1, no stdout, stderr shows a SyntaxError and dumps ~64KB of the file source.

The error is on line 2 of dist/cli.mjs:

import*as e from"path";import t,{join as n,dirname as r,...}from"path";...

The required spaces between import/*, */as, and from/"path" are missing, making this unparseable by any JavaScript engine.

Root cause

The published dist/cli.mjs (2.3 MB, 15 lines, single-line bundle) has its import statements stripped of critical whitespace. This is likely a pre-processing or obfuscation issue in the build pipeline (tsup + javascript-obfuscator). While the package.json declares "engines": {"node": ">=22"}, this is a JavaScript syntax error that would fail on any Node.js version.

Affected versions

Confirmed broken:

  • 0.52.5 (latest, as of 2026-07-27)
  • 1.4.1

Environment

  • OS: macOS (darwin)
  • Node.js: v20.20.2 (also affects any version)
  • npm: bundled with Node 20.20.2

Additional context

dist/index.mjs (the entry point) correctly imports from ./cli.mjs, so the failure happens at the next import resolution step.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions