packages/* package.json main points at non-existent compiled .js #2
Labels
No labels
area/auth
area/backend
area/ci
area/deploy
area/e2e
area/frontend
area/shared
blocked
good-first-issue
needs-info
priority/high
priority/low
priority/medium
type/bug
type/chore
type/docs
type/feature
type/tech-debt
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
celilo/lunacycle#2
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
The workspace packages declare
"main": "./src/index.js"/"types": "./src/index.d.ts", but the source is TypeScript (src/index.ts) and there is no build step producing the.js/.d.ts. Anything that resolves these packages via Node/package.jsonmain(rather than tsconfig path aliases) breaks.Affected:
packages/shared,packages/trpc-utils(and likelyui,auth-client— should audit all).How it surfaced
The root
tests/unit/shared.test.tscouldn't resolve@lunacycle/sharedunder vitest. The app vite configs resolve workspace aliases vianxViteTsPaths(), but the rootvitest.config.tsdidn't — so it fell back tonode_modulesresolution and hit the missing.js. Worked around in commit4396221by addingnxViteTsPaths()tovitest.config.ts.Why it's worth fixing properly
The workaround papers over the root cause: the package manifests advertise an entry point that doesn't exist. Any consumer not going through the nx tsconfig-paths plugin (a new tool, a script, a different test runner) will hit the same wall.
Options
dist/index.js+.d.tsand pointmain/types/exportsthere.exports/importsmap pointing at the.tssource (works for bun/vite-native consumers).main/typesand rely entirely on tsconfig path aliases (document that consumers must use them).Acceptance criteria
packages/*/package.jsonentry-point fields.@lunacycle/sharedresolves without the vitest-specific plugin workaround (or we consciously keep it and document why).