3 ms·
Node is required because that's what is used to compile the JS on the command line, it's a nodejs process. Once that's complete, any web server can serve the ne
by bstar77 5y ago
Node is required because that's what is used to compile the JS on the command line, it's a nodejs process. Once that's complete, any web server can serve the newly produced JS/CSS/HTML files.
JS is interpreted by the browser, but we compile locally so that the code produced implements workarounds for missing language features. The code produced is typically minified so that the payload sent to the browser is much smaller than it would otherwise be.
Node is analogous to Python, Ruby and PHP... they all can run webservices, power desktop apps and compile/build projects.
- throwaway_egbs 5y agoYeah, I get all that too. I think my problem was that I sort of misunderstood what Node is. I've always thought of it as a web server, not a language runtime. So to me it seemed like using Node to run command-line tools was akin to doing python -m http.server my_cool_cli_thing which is, of course, a bananas way to do things. But now that I've dug into it a little more I see that this is a misapprehension that I formed based on Node's original use case as an event-driven web server. Thanks again.