Skip to content

quicktype fails with 'Cannot find module wordwrap' when pnpm hoisting is disabled #2863

@baraknaveh

Description

@baraknaveh

quicktype@23.2.6 uses wordwrap at runtime (src/cli/index.ts) but does not declare it as a dependency in package.json. It resolves only because quicktype-core declares wordwrap as a dependency, and in flat node_modules layouts (npm, yarn) it gets hoisted to where quicktype can find it by accident.

When pnpm's hoisting is disabled (hoist: false), this breaks at runtime:

Error: Cannot find module 'wordwrap'
Require stack:
- .../node_modules/.pnpm/quicktype@23.2.6_.../node_modules/quicktype/dist/index.js

This was originally reported and fixed in #1041, but regressed in #2108 which removed wordwrap from quicktype's direct dependencies. #2480 is likely the same issue.

Workaround — add a packageExtensions entry in pnpm-workspace.yaml:

packageExtensions:
  "quicktype@23":
    dependencies:
      wordwrap: "*"

Fix — add wordwrap back to dependencies in packages/quicktype/package.json (it was removed in #2108).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    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