Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

svelte-package watch mode leaves the compiled .js of a deleted .ts file in the output

オープン 初心者向け
#17,518 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@svelte-triage-bot がすでに取り組んでいます。

2026年10月22日 から。

  • #17519 @svelte-triage-bot による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
84/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
javascript

調査の方向性

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
  1. Take any library packaged with @sveltejs/package (for example, one created by sv create with the library template).
  2. npx svelte-package -w
  3. Create src/lib/foo.ts with export const foo = 1;. dist/foo.js and dist/foo.d.ts are created.
  4. Delete src/lib/foo.ts. The watcher logs Removed foo.js.
  5. ls dist: foo.d.ts is gone, but foo.js is 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

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

sveltejs/kit のほかの issue

sveltejs/kit の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。