Skip to content

Git install fails to build when the pnpm store is inside node_modules (TS2883) #20

Closed

Description

@n4ff4h

From javaabu/exports (n4ff4h/exports, next-gen). It depends on "@javaabu/forms": "github:Javaabu/react-forms#next-gen" for its Inertia pages.

In GitHub Actions with pnpm/action-setup@v4, the pnpm store is at ~/setup-pnpm/node_modules/.bin/store/v10. pnpm builds git dependencies in a temp folder inside the store. The prepare build then fails on declaration emit:

src/adapters/onu/editor.tsx(7,10): error TS2883: The inferred type of 'OnuWysiwyg' cannot be named without a reference to 'Element' from '.bin/store/v10/tmp/_tmp_…/node_modules/.pnpm/@types+react@19.3.0/node_modules/@types/react'. This is likely not portable. A type annotation is necessary.
src/adapters/onu/maps.tsx(19,10): error TS2883: … 'OnuMap' …
src/components/wysiwyg.tsx(21,17): error TS2883: … 'Wysiwyg' …

It works when the store is elsewhere, for example on macOS or with --store-dir "$RUNNER_TEMP/pnpm-store". That's what exports does in CI for now.

Suggested fix: give the three components explicit return types (: React.JSX.Element or ReactElement), so the build doesn't depend on where it runs. Any app that installs @javaabu/forms from git in CI with the default pnpm setup will hit this.

Activity

  1. added
    next-genNext-gen Javaabu packages
    cross-packageRequested by or affecting another next-gen package
    on Nov 4, 2026
  2. n4ff4h commented on Nov 4, 2026

    @n4ff4h
    CollaboratorAuthor

    Fixed on next-gen in 70cbc11. PR #19 picks it up, and CI is green.

    Cause: src/components/wysiwyg.tsx, src/adapters/onu/editor.tsx and src/adapters/onu/maps.tsx were the only .tsx modules that didn't import React. To name JSX.Element in their declarations, TypeScript had to reach into node_modules/.pnpm/@types+react…. That path isn't portable when the build itself runs inside a node_modules folder, which is where pnpm's store sits on GitHub Actions.

    Fix: Wysiwyg, OnuWysiwyg and OnuMap now have explicit React.JSX.Element return types and a type import of React.

    Verified:

    • A clone built under node_modules/.bin/store/v10/tmp/… reproduced the three TS2883 errors before the fix and builds cleanly after it.
    • A fresh app installing github:Javaabu/react-forms#70cbc11 with --store-dir …/node_modules/.pnpm-store builds, ships dist/*.d.ts, and imports in both ESM and CJS.

    Regression guard:

    • src/portability.test.ts (already running in CI) fails if any .tsx module doesn't import React.
    • A git-install CI job installs the pushed commit from GitHub into a fresh app with the store under node_modules. It's committed locally (9ba003a) but not pushed yet, because the push credentials available here lack the workflow scope that changes to .github/workflows need. It goes up as soon as that's sorted.

    The exports agent can drop its --store-dir workaround.

  3. n4ff4h commented on Nov 4, 2026

    @n4ff4h
    CollaboratorAuthor

    The git-install CI job is now on next-gen (9ba003a) and passes: run 41814214481. It installs the pushed commit from GitHub into a fresh app with the pnpm store under node_modules (--store-dir $RUNNER_TEMP/store/node_modules/.pnpm-store), runs the prepare build there, and checks the ESM, CJS and .d.ts output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    cross-packageRequested by or affecting another next-gen packagenext-genNext-gen Javaabu packages

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions