Is there any way to run Node.js in a –  Jun 05 '18 at 21:09

  • @ChrisG PHP / ASP.NET don't work inside a script tag either, they just render, just the same as if you were using Node / express. – Keith Jun 05 '18 at 21:11
  • @Keith I'm fully aware of that, thanks. I'm explaining to Micah that his solution will most likely lead OP down a blind alley, because OP is trying to do something that does not work at all but phrased it in a misleading way. –  Jun 05 '18 at 21:13
  • @ChrisG So what was your point here -> `but I suspect OP does want to do server-side stuff right in his script tag`, and then mention PHP / ASP as if they did do server stuff right inside the script tag..? – Keith Jun 05 '18 at 21:15
  • @Keith If OP wants to run only npm modules suitable for client-side, Micah's solution is fine and exactly what OP is looking for. However I believe, based on OP mentioning PHP etc., that OP is trying to use "node-only" / server-side modules right in the browser, in which case webpack will help nothing. My point was to "warn" Micah that he's misleading OP because he's too optimistic about OP's understanding of node vs. client-side. –  Jun 05 '18 at 21:19
  • @ChrisG I think the OP just wants the ability to use npm packages in his client side script. I am basing this of a statement he made, "The reason for this is I would like to use require()'d modules from NPM in my browser javascript, ". Webpack has this capability, so I suggested it to him. I could be wrong about what he wanted. Maybe we will get more feedback from the OP. – MicahB Jun 05 '18 at 21:26
  • @MicahBell Not to be rude or anything, but I'm aware of your assessment. It's why you posted the above answer. My assessment is different, mostly because of [this](https://stackoverflow.com/questions/50601868/node-js-loading-html-in-a-similar-way-to-php) –  Jun 05 '18 at 21:31
  • @ChrisG I understand what you are saying. I don't think its rude. You are skeptical of whether or not the OP understands the technologies or not. The OP didn't ask me to critique his understanding of PHP or NodeJs. I probably wouldn't of answered if that was the case. – MicahB Jun 05 '18 at 21:49
  • This answer would be a lot more appropriate if it explained the limitations for webpack (e.g. lots of NPM modules you cannot use in a browser because you can only use modules that will run in a browser - you aren't running node.js in a browser at all). – jfriend00 Jun 06 '18 at 04:06