Converting ES6 to ES5 on the command line

Updated . Posted . Visible to the public.

I use the TypeScript compiler for this, since its output is more minimal than Babel's.

The following will transpile all src/*.js files into a file build.js:

npm install typescript
npx tsc src/*.js --target ES5 --allowJs --outFile build.js

The output will only transpile ES6 syntax. It will not include any polyfills for missing APIs.

Henning Koch
Last edit
Dominik Schöler
License
Source code in this card is licensed under the MIT License.
Posted by Henning Koch to makandra dev (2021-03-23 14:23)