babel / babel

🐠 Babel is a compiler for writing next generation JavaScript.
https://babel.dev
MIT License
43.24k stars 5.64k forks source link

babel-cli in --watch mode doesn't delete output file when source file is deleted #9293

Open henbjo opened 5 years ago

henbjo commented 5 years ago

Bug Report

Current Behavior When I run babel-cli with the --watch flag, files that I delete from my src directory still remain present in the output directory.

Expected behavior/code Because babel-cli watches my src directory, I would expect it to detect deleted files and delete the corresponding output file as well.

Babel Configuration (.babelrc, package.json, cli command)

{
  "presets": [
    [
      "@babel/preset-env",
      {
        "targets": "> 0.25%, not dead",
        "modules": false
      }
    ]
  ]
}

Environment

Possible Solution Listen to unlink events when watching the source tree and delete the corresponding output files.

Additional context Issue 5636 already discusses this problem, and this comment suggests it should be the default behavior.

babel-bot commented 5 years ago

Hey @henbjo! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite.