- Pure
node index.js
, nothing more -- but which ECMA version, on which Node version? -
@babel/node, i.e.
babel-node
- TypeScript's ts-node
-
deno run index.ts
-- you speltnode
wrong. - Restartable variants, e.g. nodemon, node-dev, ts-node-dev
Also, do you use non-pure version in production? What about NPM library publishing?
Top comments (4)
This is a fun question. It really depends on what I'm working on. If I'm doing something in plain JS without an dependencies (rare) it's easy enough to just
node index.js
. When I'm working on an Express server I add a script to mypackage.json
calleddev
that starts up nodemon, so I can justyarn dev
and leave the server up while I work on it.Personally, I am a TypeScript user, so I use both
ts-node
,ts-node-dev
in development. And,node
in production.TypeScript is already Babel-like with additional features, and can transpile down to Node12, Node10 or Node8, so this
tsconfig.json
should be safe enough.Recently, I have problems with absolute imports, but I practically fixed it.
TypeScript, simplified import paths, and what you have to be careful
Pacharapol Withayasakpunt ・ Jul 23 ・ 2 min read
That is, if in
package.json
is"main": "index.js"
.Its usually
ts-node-dev src/index.ts
in development