Search code examples
compilationecmascript-6babeljsbabel-polyfill

How to use babel with simple HTML file without build system?


How to use babel with simple HTML file without build system?

The command-line TypeScript compiler can be installed as a Node.js package.

INSTALL
npm install -g typescript
COMPILE
tsc helloworld.ts

Than I added compiled file to HTML and it works fine.

How I can implement it with babel?

Fox example write es6 code, than compile in terminal and add this compiled script to index.hmtl.


Solution

  • http://babeljs.io/docs/setup/#installation - choose CLI

    INSTALL
    npm install -g babel-cli
    COMPILE
    babel helloworld.es6.js -d helloworld.js