4 ms·
You literally said "this even includes front-end code for the browser". So what exactly are you referring to here?
by root_axis 3mo ago
You literally said "this even includes front-end code for the browser".
So what exactly are you referring to here?
- austin-cheney 3mo agoI 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.
- deleted 3mo ago[deleted]
- root_axis 3mo agoYou write all your code in TS - great. You run node with the TS support - great. 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.
- austin-cheney 3mo ago> 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.
- root_axis 3mo agoYes, 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.
- austin-cheney 3mo agoOn 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.
- root_axis 3mo ago> On application startup I assemble together the various front end files I need and store this in memory as a string. So in other words, you created your own bundler? Node isn't actually doing the work for you on the front-end.
- austin-cheney 3mo agoAgain, I never said Node is did anything for the front end.
- root_axis 3mo agoAgain, yes you explicitly did: > I just write my code and then point node at the main file, and this even includes front-end code for the browser. It sounds like you're just making stuff up.
- austin-cheney 3mo agoIf you hire me as a consultant I will do it for you at $150 per hour.
- root_axis 3mo agoYou said: > I just write my code and then point node at the main file, and this even includes front-end code for the browser. Then you said: > I never said Node is did anything for the front end. So which is it?