Skip to content

--watch flag does not work under the same directory and documentation outdated #10398

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
iwaduarte opened this issue Apr 21, 2025 · 1 comment
Assignees
Labels
Milestone

Comments

@iwaduarte
Copy link

iwaduarte commented Apr 21, 2025

Describe the bug

There are two (2) problems related to the --watch flag that I want to report:

Outdated documentation

The documentation probably have outdated information.

swc seems to work fine without chokidar but the documentation states

Image

watch does not work in root folder (without /src nested folder level)

--watch does not work if the directory is under the same level as

backend/
├── dist/
├── controllers/
└── services/

So inside /backed something like "swc . -d dist -w" does not work. The build compiles and the application exits (does not stay actively listening to changes).

Input code

Config

{
  "$schema": "https://swc.rs/schema.json",
  "jsc": {
    "parser": {
      "syntax": "typescript",
      "tsx": false,
      "decorators": false
    },
    "target": "es2020"
  },
  "module": {
    "type": "es6",
  }
}

Link to the code that reproduces this issue

https://play.swc.rs/?version=1.11.21&code=H4sIAAAAAAAAAzWKsQ2AMAwEeyR2eDEA2QQaFjDEKJaSOHLcIMTu0NCd7i6ELTGa6Z65QDq05gvGmZwjXOFfPrKAasSybr9yo9qbfJtoDYeWn9ESdZ7HQUpTc9wPTtOCKZLT9AI6np1%2BbwAAAA%3D%3D&config=H4sIAAAAAAAAA1WPSw7DIAwF9zkF8rrbdtE79BCIOhERP9mOVBTl7oUE0maH3xszsA5KwcwGnmotxzIkTYx0ziXhHER%2FSgKSE7IhmwRuvRWu1agd4x5tRwOiaUKpW8j3hoOLkbHjLfM22DH%2FC030iZD5ClZUh8nhVTc0Jfj4XvayfaQ%2B9tA%2F4Ad12XkxWH71TaEFh%2B0LYuVI0xQBAAA%3D

SWC Info output

Operating System:
    Platform: win32
    Arch: x64
    Machine Type: x86_64
    Version: Windows 11 Pro
    CPU: (16 cores)
        Models: 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz

Binaries:
    Node: 22.14.0
    npm: N/A
    Yarn: N/A
    pnpm: N/A

Relevant Packages:
    @swc/core: 1.11.18
    @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

--watch should work for root files without being forced to work with src/ and /dist strategy
--watch documentation should be updated to remove the use of chokidar

Actual behavior

No response

Version

1.11.18

Additional context

No response

@iwaduarte iwaduarte changed the title watch does not compiler under new added files watch does not compilerunder new added files Apr 21, 2025
@iwaduarte iwaduarte changed the title watch does not compilerunder new added files watch does not compile under new added files Apr 21, 2025
@iwaduarte iwaduarte changed the title watch does not compile under new added files --watch flag does not work under the same directory and documentation outdated Apr 21, 2025
@iwaduarte
Copy link
Author

iwaduarte commented Apr 21, 2025

Note: The issue preventing file creation was not related to SWC (not a bug). It was caused by the IDE not automatically reflecting new files. I have updated accordingly.

@kdy1 kdy1 self-assigned this Apr 21, 2025
@kdy1 kdy1 added this to the Planned milestone Apr 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants