Skip to content
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

compile with --watch flag results in "unexpected argument '--watch' found" #28142

Open
wiledal opened this issue Feb 16, 2025 · 2 comments
Open

Comments

@wiledal
Copy link

wiledal commented Feb 16, 2025

Version: Deno 2.0.3 and 2.1.10

Hello! 👋

According to the docs, we should be able to use the --watch flag with the compile subcommand.

https://docs.deno.com/runtime/getting_started/command_line_interface/#watch-mode

However, when adding --watch after deno compile we are greeted with

➜ deno compile --watch index.ts
error: unexpected argument '--watch' found

  tip: to pass '--watch' as a value, use '-- --watch'

Usage: deno compile [OPTIONS] [SCRIPT_ARG]...

From what I can tell, this only happens withcompile, while run, test, fmt all start the watcher successfully.

Are the docs wrong? Is this expected? Or am I doing something wrong here?

@dsherret
Copy link
Member

The docs are wrong. I opened denoland/docs#1432

On adding a --watch flag to deno compile, I'm not sure if it's so useful because you need to manually execute the executable after anyway. I usually do:

deno compile main.ts && ./my_executable

@wiledal
Copy link
Author

wiledal commented Feb 17, 2025

Ah I see. For my use-case it actually is useful, as I have symlinked the compiled result as a global command, and having updates propagate without an extra command is neat.

For my case though, I can set up a separate watcher (maybe nodemon) to execute the compilation step on change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants