Skip to content

Instantly share code, notes, and snippets.

@jschuur
Last active December 9, 2019 10:20
Show Gist options
  • Save jschuur/81af7281542eb7d5a908591046cd4835 to your computer and use it in GitHub Desktop.
Save jschuur/81af7281542eb7d5a908591046cd4835 to your computer and use it in GitHub Desktop.
ESNext, TypeScript, Babel, Parcel setup for a Node project

ESNext, TypeScript, Babel, Parcel setup instructions for a Node project

Add dev dependencies:

npm i -D @babel/core @babel/node @babel/preset-env @babel/preset-typescript typescript nodemon parcel

Add the following NPM scripts:

    "start": "node dist/index.js",
    "dev": "babel-node index.ts --extensions \".ts\"",
    "dev:watch": "nodemon --exec babel-node index.ts --extensions \".ts\"",
    "build": "parcel build index.ts"

Create a .babelrc file with the following contents:

{
  "presets": [
    "@babel/preset-typescript",
    [
      "@babel/preset-env",
      {
        "targets": {
          "node": "current"
        }
      }
    ]
  ]
}

Further reading

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