Skip to content

Instantly share code, notes, and snippets.

@pedropalhari
Created May 5, 2021 18:01
Show Gist options
  • Save pedropalhari/a395a32d421007d2f83764559b849c08 to your computer and use it in GitHub Desktop.
Save pedropalhari/a395a32d421007d2f83764559b849c08 to your computer and use it in GitHub Desktop.
Node.js with Typescript without the massive ts-node overhead
#export NODE_PATH=/home/pedro/.nvm/versions/node/v14.16.0/lib/node_modules
export NODE_PATH=
alias tnode="node -r @swc-node/register"
@pedropalhari
Copy link
Author

When starting pm2, create a file with:

//pm2.js

require("@swc-node/register");
require("index.ts");

And run it with pm2 start pm2.js --name api

@pedropalhari
Copy link
Author

Or with the ts-node lesser overhead:

alias tnode="ts-node --transpile-only -O '{\"esModuleInterop\": true, \"skipLibCheck\": true}'"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment