svelte-package watch mode leaves the compiled .js of a deleted .ts file in the output
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 84/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- javascript
- 領域
- build-system, tooling
調査の方向性
packages/package/src/index.js の watcher の unlink 分岐から始め、次に issue で言及されている既存の「watches for changes」テストを読みます。watch モード中に src/lib/b.ts を削除して再現し、package/b.js が削除されるか確認します。削除または名前変更された TypeScript ファイルのコンパイル済み出力が削除され、回帰テストが成功すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
In watch mode (svelte-package -w), deleting or renaming a .ts module in src/lib removes its .d.ts from the output directory, but the compiled .js stays there. The watcher still logs Removed foo.js.
The unlink branch in packages/package/src/index.js deletes path.join(output, file.name). That is the source path (foo.ts), which never exists in the output. It never deletes file.dest (foo.js). The same applies to Svelte files with a custom extension from config.extensions (for example .svx), whose output is .svelte.
The stale file stays until the next build without --preserve-output. Meanwhile it can still be imported, and it gets published if someone runs npm publish on a watched output directory.
Reproduction
- Take any library packaged with
@sveltejs/package(for example, one created bysv createwith the library template). npx svelte-package -w- Create
src/lib/foo.tswithexport const foo = 1;.dist/foo.jsanddist/foo.d.tsare created. - Delete
src/lib/foo.ts. The watcher logsRemoved foo.js. ls dist:foo.d.tsis gone, butfoo.jsis still there.
Logs
Processing foo.ts
Removed foo.js
(dist/foo.js still exists afterwards.)
System Info
System:
OS: macOS 27.0.1 (arm64)
Binaries:
Node: 26.8.2
npmPackages:
@sveltejs/package: 3.0.1 (also 3.0.0 and main)
Severity
annoyance
Additional Information
A likely fix is to delete file.dest instead of file.name in that branch. For .js and .svelte files the two are the same, so their behaviour wouldn't change. With that change, a test in the existing "watches for changes" test that deletes src/lib/b.ts and checks that package/b.js is gone passes; without it, the test fails.
- 主要言語
- JavaScript
- スター
- 20.9k
- フォーク
- 2.4k
- 平均マージ
- 1日 16時間
- マージ済み PR(30日)
- 82
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
sveltejs/kit のほかの issue
-
awaiting submitter
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
adapter-cloudflare: `cloudflare:workers` keeps using the old platform proxy after the Wrangler config reloads in dev対応中かも @svelte-triage-bot が 6 日前に担当しました。 オープンpkg:adapter-cloudflare
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
Prerendering no longer shows progress再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
sveltejs/kit#17163 · コメント 4 件 ·
メンテナーはふだん 1 日以内に返信
-
sync: concurrent runs can read a truncated route_meta_data.json (JSON.parse error)対応中かも @Nic-Polumeyv が 32 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
bug 優先: 低
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
admission-deferred priority: medium status: ready work-class: scoped
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
melodic-software/claude-code-plugins#10887 · コメント 4 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
-
難易度 1/5 1〜3時間 初心者へのやさしさ 91/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 2 日以内に返信