I write all my application code in TypeScript, even if it is for the browser. I then import all that code into Node regardless of whether it will execute in Node. All code that will not execute in Node needs to be wrapped in a function for safety, because global references like "document" or "window" will not work in Node.
That doesn't explain how your front-end TS code is transformed into JS. You seem to be suggesting that node does it automatically, but it doesn't. The explanation of your setup isn't adding up.
> That doesn't explain how your front-end TS code is transformed into JS.
Node will do that at run time. Its automatic. Functions do not have to execute to receive this benefit. They just have to be imported. Ensure you are using a very recent version of Node.
Yes, but how does your http server deliver the imported code to the front-end? Are you using some type of streaming bundler that does real time builds? Something isn't making sense here.
On application startup I assemble together the various front end files I need and store this in memory as a string. When the server sees a request for the desired page I respond with the desired string.
Since I am not handcuffed by some giant framework I have maximum flexibility to do what makes sense.
Yes, I push all my TS code through Node for type stripping. No, Node is not executing browser code. No, I am not suggesting Node is running in the browser.
For extra extra extra clarity importing functions in JavaScript does not execute them. They still have to be called for them to execute.
I am still willing to fix your code for a consultation fee.
Confusing or not it works for me. No compile step and no build step. The application starts up in 0.2 seconds on Linux and about 1.2 seconds on Windows.
Yeah, IMO they are just making stuff up. Even as explained what they're saying makes no sense. Ultimately, there needs to be some entrypoint into the client-side script, node has no built in way to serve source code it's type-stripped over http.
If Node is your web server then node does have a way to serve the code to the browser... or you could just have node write the stripped code to a file for your other web server. It sounds like you are not even trying to think through this. I recommend putting fingers on keyboard and just trying to find your way through the solution instead of complaining about how impossible life is.
> I recommend putting fingers on keyboard and just trying to find your way through the solution instead of complaining about how impossible life is.
I recommend you stop making stuff up online. We're 10 layers deep into this thread and you still can't explain how any of this works in a coherent way.
If any of this is real, why don't you attach a link from the node documention or an article that explains this technique that allows node to serve type stripped imports over http.
I'm not asking for a link to the http stack, I'm asking you to explain how you run a node app that consumes your typescript source code and serves it over http without a bundler.