-
Notifications
You must be signed in to change notification settings - Fork 48
Description
Description:
When using tsci build with a component imported from the tscircuit registry (e.g., @tsci/seveibar.smd-usb-c), the build fails with a module resolution error. The same circuit works fine with tsci dev.
Steps to Reproduce:
- Create a new tscircuit project: tsci init
- Install a registry component: bun add @tsci/seveibar.smd-usb-c
- Create a circuit using the component:
import { SmdUsbC } from "@tsci/seveibar.smd-usb-c"
export default () => (
<board width="30mm" height="30mm">
<SmdUsbC name="J1" pcbX={0} pcbY={0} />
</board>
)
- Run tsci dev - works fine
- Run tsci build - fails
Error:
error: Cannot find module '@tscircuit/core' from '/path/to/project/node_modules/@tsci/seveibar.smd-usb-c/index.cjs'
Building 1 file(s)...
Building index.tsx...
Generating circuit JSON...
Analysis:
The @tsci/seveibar.smd-usb-c package's package.json doesn't declare @tscircuit/core as a dependency or peerDependency:
{
"name": "@tsci/seveibar.smd-usb-c",
"version": "0.0.2",
"main": "index.cjs",
"module": "index.js",
"types": "index.d.ts"
}
But index.cjs requires it at runtime. This works in tsci dev (likely due to bundling), but fails in tsci build which runs the CJS file directly.
Workaround:
Define the component inline using instead of importing from the registry.
Expected Behavior:
tsci build should work with registry components, or registry components should declare their dependencies properly.
Environment:
- @tscircuit/cli: 0.1.755
- @tsci/seveibar.smd-usb-c: 0.0.2
- Runtime: Bun 1.3.5
- OS: macOS