- 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 speltnodewrong. - 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.jsoncalleddevthat starts up nodemon, so I can justyarn devand leave the server up while I work on it.Personally, I am a TypeScript user, so I use both
ts-node,ts-node-devin development. And,nodein production.TypeScript is already Babel-like with additional features, and can transpile down to Node12, Node10 or Node8, so this
tsconfig.jsonshould 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.jsonis"main": "index.js".Its usually
ts-node-dev src/index.tsin development