Description
In a fresh tsci init project, adding some registry components makes tsci build fail with:
error: Cannot find module '@tscircuit/core' from '.../node_modules/@tsci/Anshgrover23.AMS1117_3_3/index.cjs'
Fatal error [circuit_generation_failed]: ResolveMessage: Cannot find module '@tscircuit/core'
Steps to reproduce
tsci init my-board (tscircuit 0.0.2205, cli 0.1.1804, bun 1.3.14)
tsci add Anshgrover23/AMS1117_3_3
- Use it in
index.circuit.tsx and run tsci build
Root cause (as far as I can tell)
The registry's CJS build of that component starts with:
var core = require('@tscircuit/core');
but @tscircuit/core (0.0.1581 in a fresh project) is now ESM-only — "type": "module" and an exports map with only an import condition:
"exports": { ".": { "import": "./dist/index.js", "types": "./dist/index.d.ts" } }
so the require() can never resolve. Components with newer registry builds (e.g. @tsci/seveibar.smd-usb-c, @tsci/seveibar.WS2812B_2020) don't reference @tscircuit/core from their CJS output and work fine in the same project — the breakage seems limited to components whose published build predates core going ESM-only (this one imports createUseComponent from core).
#1657 reported the same symptom in April; it was read as a not-installed problem and auto-closed by the stale bot, but it still reproduces today with the package above.
Why it hurts
You only find out at build time, with a module-resolution error that points at a package you installed exactly the way the site suggests. There's no way for a user to tell "this component's published build is stale" from "my project is broken" — I lost a while re-checking my own setup before diffing the working vs failing packages' index.cjs. Anything that either rebuilds stale registry artifacts, adds a require condition/CJS entry to core, or fails tsci add early with "this component needs a rebuild" would fix the experience.
Happy to provide the full project if useful — my workaround was converting the part locally with the easyeda library and importing the generated .tsx instead of the registry package.
Description
In a fresh
tsci initproject, adding some registry components makestsci buildfail with:Steps to reproduce
tsci init my-board(tscircuit 0.0.2205, cli 0.1.1804, bun 1.3.14)tsci add Anshgrover23/AMS1117_3_3index.circuit.tsxand runtsci buildRoot cause (as far as I can tell)
The registry's CJS build of that component starts with:
but
@tscircuit/core(0.0.1581 in a fresh project) is now ESM-only —"type": "module"and an exports map with only animportcondition:so the
require()can never resolve. Components with newer registry builds (e.g.@tsci/seveibar.smd-usb-c,@tsci/seveibar.WS2812B_2020) don't reference@tscircuit/corefrom their CJS output and work fine in the same project — the breakage seems limited to components whose published build predates core going ESM-only (this one importscreateUseComponentfrom core).#1657 reported the same symptom in April; it was read as a not-installed problem and auto-closed by the stale bot, but it still reproduces today with the package above.
Why it hurts
You only find out at build time, with a module-resolution error that points at a package you installed exactly the way the site suggests. There's no way for a user to tell "this component's published build is stale" from "my project is broken" — I lost a while re-checking my own setup before diffing the working vs failing packages'
index.cjs. Anything that either rebuilds stale registry artifacts, adds arequirecondition/CJS entry to core, or failstsci addearly with "this component needs a rebuild" would fix the experience.Happy to provide the full project if useful — my workaround was converting the part locally with the easyeda library and importing the generated
.tsxinstead of the registry package.