Rebuild to fix lib import errors

From LedgerHQ/ledger-live · View interactive version

Rebuild to fix lib import errors is an AI agent skill from the GitHub repository LedgerHQ/ledger-live. Rebuild a monorepo lib when typecheck fails on an import that resolves to its built output, and tell that case apart from an import read from source. Read when a typecheck reports an import error from a monorepo lib.

How to use this skill

Skill file

Look at the file the consumer resolves the import to, not at whether the lib has a build target.

The @support/tsconfig presets set the @ledgerhq/source condition, so most consumers resolve even a

published lib to its src/ (the --traceResolution output of tsc shows the resolved file):

changes. That happens when the exports entry has no @ledgerhq/source condition, or when the

consumer's config clears customConditions (a tsconfig.build.json). Rebuild the lib.

when the lib keeps an nx:noop build target. Go to the source-only checks below. One exception:

a lib whose no-build entry in

CODE0

says its build generates files under src/ needs that build when those files are missing.

Built output: rebuild the lib

nx run @ledgerhq/name_of_lib_here:build

When several are stale, pnpm build:libs runs build on the @ledgerhq packages, minus the ones its

script in the root package.json excludes.

Source: no build to refresh

The error is in the source or the exports map, and a rebuild cannot fix it. Check that:

package checklist;

typescript.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.