It looks like you're asking for a couple of things here:
- Something to remove comments from your source code
- Something to make it impossible to read the source code
Removing comments/reducing file size
Minification reduces source code file size by remove unnecessary indentation, semicolons, newlines, etc. It also removes all comments as they are not necessary for the code to function properly. javascript-obfuscator can help you out with this.
If you only want the comments removed (keeping indentation, newlines, etc.), I'd suggest using strip-comments.
Making code unreadable
The above options will reduce your source code size, but not make it unreadable. For that you have 2 options: a code obfuscator, or packaging your code into an executable (this has the added benefit of not requiring node on the target device).
Obfuscation makes your code difficult for a human to understand. However, will not guarantee that nobody can read your source code, as a determined person could theoretically reverse engineer the obfuscated code. If all you'd like is to deter someone through obfuscation, javascript-obfuscator can help you.
The best way to ensure your code is unreadable is to package it into an executable. This also will eliminate the need for the target device your code will run on to have node installed. pkg by Vercel is a good package for this.