egoist / egoist/tsup

CJS Build failed

Open
#824 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
11.3k
Forks
275
PR merge metrics
No merged PRs in 30d

Description

导出ts类型声明时报错(Error occurred when exporting ts type declaration)
// index.ts 导出类型时
`export * from '../types/index'`

// types/index.d.ts

`
// 错误解析模型
export interface ParseStack {
errorType: string
msg: string
list: ParseStackItem[]
}
export interface ParseStackItem {
url: string
line: number
column: number
filename: string
}
`

报错信息:
`src/index.ts:15:14: ERROR: Could not resolve "../types/index"
at failureErrorWithLog (/Users/supaur/Desktop/gitProject/alpha/abnormal-sdk/node_modules/.pnpm/esbuild@0.15.18/node_modules/esbuild/lib/main.js:1575:15)
at /Users/supaur/Desktop/gitProject/alpha/abnormal-sdk/node_modules/.pnpm/esbuild@0.15.18/node_modules/esbuild/lib/main.js:1033:28
at runOnEndCallbacks (/Users/supaur/Desktop/gitProject/alpha/abnormal-sdk/node_modules/.pnpm/esbuild@0.15.18/node_modules/esbuild/lib/main.js:1447:61)
at buildResponseToResult (/Users/supaur/Desktop/gitProject/alpha/abnormal-sdk/node_modules/.pnpm/esbuild@0.15.18/node_modules/esbuild/lib/main.js:1031:7)
at /Users/supaur/Desktop/gitProject/alpha/abnormal-sdk/node_modules/.pnpm/esbuild@0.15.18/node_modules/esbuild/lib/main.js:1143:14
at responseCallbacks. (/Users/supaur/Desktop/gitProject/alpha/abnormal-sdk/node_modules/.pnpm/esbuild@0.15.18/node_modules/esbuild/lib/main.js:680:9)
at handleIncomingPacket (/Users/supaur/Desktop/gitProject/alpha/abnormal-sdk/node_modules/.pnpm/esbuild@0.15.18/node_modules/esbuild/lib/main.js:735:9)
at Socket.readFromStdout (/Users/supaur/Desktop/gitProject/alpha/abnormal-sdk/node_modules/.pnpm/esbuild@0.15.18/node_modules/esbuild/lib/main.js:656:7)
at Socket.emit (events.js:400:28)
at addChunk (internal/streams/readable.js:293:12)`

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the CJS build and inspect the export at src/index.ts:15 alongside types/index.d.ts. Check how the declaration file is resolved during the build and compare the result with the reported esbuild error. Done means the CJS build completes while exporting the ParseStack types.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
build-system, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.