3 ms·
Your comment got me curious if it’s at all possible to build a Node web service without importing any Node modules (ie with just the global/module-local namespa
by eyelidlessness 3y ago
Your comment got me curious if it’s at all possible to build a Node web service without importing any Node modules (ie with just the global/module-local namespace). Glancing at the globals docs, I think you’d be limited to WASM, binary extensions (like N-API), or maaaaaaybe doing something horrifically hacky with CJS require.
- tomashubelbauer 3y agoYou can also use HTTP ESM imports which is how I like to build dependencies for my personal projects. In Node I think you still need a special loader for this, in Deno, this is a native feature.
- DecoPerson 3y agoIf you’re OK importing node’s internal modules [0], which I believe are loaded anyway, you could achieve a lot, though it definitely wouldn’t be worth it. No developer is an island. [1] [0] https://github.com/nodejs/node/tree/main/lib/internal https://github.com/nodejs/node/tree/main/lib/internal [1] https://youtu.be/TY9xsT6S75A?si=uqPUuxKNl_1vqMhm https://youtu.be/TY9xsT6S75A?si=uqPUuxKNl_1vqMhm