You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix watching relative dirs in @swc/cli due to change in chokidar@v4 (#82)
When watching on `--out-dir`, `@swc/cli` would compile the sources when
a relative path was passed, but watching would immediately exit instead
of watch for changes.
Chokidar version 4.x [removes globbing
support](https://github.com/paulmillr/chokidar/releases/tag/4.0.0),
which means that it does not recursively watch unresolved relative paths
with either globbing or cwd. The documentation recommends resolving the
glob(s) before passing to `watch`, and has some examples.
Weighing the options, it appeared to be more ergonomic to use
`globSources` to resolve the files to watch rather than create a new
method of globbing or directly glob the files. This pull request makes a
very small change to the parameters of `watchSources`, as I could not
cause the error to occur on individual files and wanted to leave that
signature alone. However, when watching on `--out-dir`, watching would
immediately exit as a relative file did not exist and was not being
resolved via globbing anymore.
This restores the ability to pass relative paths and globs to the `swc`
command of `@swc/cli` and successfully watch for changes of the source
files.
0 commit comments