vercel / micro-dev

The development environment for `micro`
MIT License
704 stars 77 forks source link

cwd is always watched for reload although path is passed #64

Open devgar opened 6 years ago

devgar commented 6 years ago

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.

tungv commented 6 years ago

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

devgar commented 6 years ago

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]
tungv commented 6 years ago

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".