egoist / egoist/tsup

typescript error

Open
#1,369 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

@echo off
echo 🚀 开始构建...
echo 当前路径: %~dp0
echo.

call npx tsup ./index.ts --format esm --target node18 --outDir dist --clean --sourcemap --dts-resolve --external "*" --no-treeshake

if %errorlevel% == 0 (
echo.
echo ✅ 构建成功!
) else (
echo.
echo ❌ 构建失败!
)

echo.
pause

PS F:\pro\1\packages\lib-vanilla\electronBase\main> .\build.bat
? 开始构建...
当前路径: F:\pro\1\packages\lib-vanilla\electronBase\main\

CLI Building entry: index.ts
CLI Using tsconfig: ..\..\tsconfig.json
CLI tsup v8.5.0
CLI Target: node18
CLI Cleaning output folder
ESM Build start
ESM dist\index.mjs 332.68 KB
ESM dist\index.mjs.map 925.85 KB
ESM ⚡️ Build success in 499ms
DTS Build start
Error: namespace child (hoisting) not supported yet

24712 |
24713 | declare module 'electron' {
> 24714 | export = Electron.CrossProcessExports;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
24715 | }
24716 |
24717 | declare module 'electron/main' {
at DeclarationScope.convertNamespace (F:\pro\1\node_modules\.pnpm\tsup@8.5.0_postcss@8.5.6_tsx@4.20.6_typescript@5.8.3\node_modules\tsup\dist\rollup.js:5773:19)
at Transformer.convertNamespaceDeclaration (F:\pro\1\node_modules\.pnpm\tsup@8.5.0_postcss@8.5.6_tsx@4.20.6_typescript@5.8.3\node_modules\tsup\dist\rollup.js:5912:18)
at Transformer.convertStatement (F:\pro\1\node_modules\.pnpm\tsup@8.5.0_postcss@8.5.6_tsx@4.20.6_typescript@5.8.3\node_modules\tsup\dist\rollup.js:5891:23)
at new Transformer (F:\pro\1\node_modules\.pnpm\tsup@8.5.0_postcss@8.5.6_tsx@4.20.6_typescript@5.8.3\node_modules\tsup\dist\rollup.js:5836:16)
at convert (F:\pro\1\node_modules\.pnpm\tsup@8.5.0_postcss@8.5.6_tsx@4.20.6_typescript@5.8.3\node_modules\tsup\dist\rollup.js:5827:27)
at Object.transform (F:\pro\1\node_modules\.pnpm\tsup@8.5.0_postcss@8.5.6_tsx@4.20.6_typescript@5.8.3\node_modules\tsup\dist\rollup.js:6227:29)
at handleDtsFile (F:\pro\1\node_modules\.pnpm\tsup@8.5.0_postcss@8.5.6_tsx@4.20.6_typescript@5.8.3\node_modules\tsup\dist\rollup.js:6343:48)
at Object.transform (F:\pro\1\node_modules\.pnpm\tsup@8.5.0_postcss@8.5.6_tsx@4.20.6_typescript@5.8.3\node_modules\tsup\dist\rollup.js:6382:20)
at F:\pro\1\node_modules\.pnpm\rollup@4.52.4\node_modules\rollup\dist\shared\rollup.js:3392:40
Error: error occurred in dts build
at Worker. (F:\pro\1\node_modules\.pnpm\tsup@8.5.0_postcss@8.5.6_tsx@4.20.6_typescript@5.8.3\node_modules\tsup\dist\index.js:1545:26)
at Worker.emit (node:events:518:28)
at MessagePort. (node:internal/worker:268:53)
at [nodejs.internal.kHybridDispatch] (node:internal/event_target:827:20)
at MessagePort. (node:internal/per_context/messageport:23:28)
DTS Build error

? 构建失败!

请按任意键继续. . .

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure from packages/lib-vanilla/electronBase/main using the shown npx tsup command and inspect index.ts with ..\..\tsconfig.json. Start with tsup's DTS build handling of the electron declaration at the reported namespace-hoisting location. Done means the DTS build completes successfully for this entry point without the reported error.

Written by the indexing model from the issue text.

Assessment

Tech stack
electron, typescript
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.