micro-dev icon indicating copy to clipboard operation
micro-dev copied to clipboard

cwd is always watched for reload although path is passed

Open devgar opened this issue 7 years ago • 3 comments

I was expecting that launching micro-dev api will only watch 'api' folder but it is reloading after any file on my project changes, also outside api folder.

I have solved that using --ignore flag but I find the behavior that I expected more rational.

devgar avatar Jan 22 '18 12:01 devgar

micro-dev CLI expect a file instead (it will attempt to resolve index.js file if you give a folder, the same way require resolves paths).

To watch a specific folder, you can use --watch or -w

tungv avatar Jan 22 '18 12:01 tungv

Thanks, you have solved my problem. I was confused about --watch usage, --help says:

    -w, --watch <dir>   A directory to watch in addition to [path]

devgar avatar Jan 22 '18 15:01 devgar

I think the help text is almost correct. the [path] is always watched. in your situation, [path] === api/index.js. I think the missing piece in the help is that it should say "if watch is not set, micro-dev will watch your cwd".

tungv avatar Jan 22 '18 16:01 tungv