8000 `swc --watch` does not detect newly added files · Issue #10520 · swc-project/swc · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to conte 10000 nt
swc --watch does not detect newly added files #10520
Open
@gabrielbull

Description

@gabrielbull

Describe the bug

The --watch mode in the SWC CLI does not detect newly added files within the watched directory. It only watches files that existed when the process started, which severely limits its usefulness for development workflows where new files are created.

Reproduction

  1. Run:
swc src -d dist --watch  
  1. Create a new .ts or .js file under src/

  2. Observe: the new file is not compiled, and no rebuild is triggered

Input code

Config

{
  "$schema": "https://swc.rs/schema.json",
  "sourceMaps": true,
  "minify": false,
  "jsc": {
    "parser": {
      "syntax": "typescript",
      "decorators": true,
      "dynamicImport": true
    },
    "transform": {
      "decoratorMetadata": true
    },
    "target": "es2023",
    "baseUrl": "./"
  },
  "module": {
    "type": "commonjs"
  }
}

Link to the code that reproduces this issue

CLI issue

SWC Info output

Operating System:
    Platform: darwin
    Arch: x64
    Machine Type: x86_64
    Version: Darwin Kernel Version 24.5.0: Tue Apr 22 19:53:26 PDT 2025; root:xnu-11417.121.6~2/RELEASE_X86_64
    CPU: (16 cores)
        Models: Intel(R) Xeon(R) W-2140B CPU @ 3.20GHz

Binaries:
    Node: 22.16.0
    npm: 10.9.2
    Yarn: 4.9.1
    pnpm: N/A

Relevant Packages:
    @swc/core: 1.11.29
    @swc/helpers: N/A
    @swc/types: 0.1.21
    typescript: 5.8.3

SWC Config:
    output: N/A
    .swcrc path: N/A

Next.js info:
    output: N/A

Expected behavior

New files added to the watched directory should trigger compilation, just like modified files.

Actual behavior

No response

Version

0.7.7

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0