Skip to content

tslib is in devDependencies → Cannot find module 'tslib' on global install #2629

Description

@JvE-iO

tslib is in devDependencies → Cannot find module 'tslib' on global install

Repo: contentstack/cli — package @contentstack/cli

@contentstack/cli require("tslib") at runtime (e.g. lib/help.js) but lists tslib in
devDependencies, not dependencies. Consumers don't get devDependencies, so tslib is never
installed and the CLI errors out on install.

Repro:

pnpm add -g @contentstack/cli
csdx --help

→ ends with [MODULE_NOT_FOUND] ... @contentstack/cli/lib/help.js: Cannot find module 'tslib'.

Confirmed from the registry:

$ curl -s https://registry.npmjs.org/@contentstack/cli/1.64.0 | jq '{dep:.dependencies.tslib, dev:.devDependencies.tslib}'
{ "dep": null, "dev": "^2.8.1" }

You don't hit it in dev because .npmrc has shamefully-hoist=true, which hoists tslib into a
resolvable spot — but that's not published, so it doesn't help users. npm users also mostly dodge
it via flat node_modules. Not OS-specific.

Fix: move tslib to dependencies in packages/contentstack/package.json (or set
importHelpers: false in tsconfig so no runtime tslib is needed). Worth checking the other
packages/* plugins for the same misplacement.

Note: a global install also throws a larger wall of tslib errors from the @contentstack/cli-launch
plugin — that's a separate package (contentstack/launch-cli) with the same bug; filed there too.

Env: cli 1.64.0, @oclif/core 4.11.11, pnpm 11.9.0, node 23.9.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions