Running BabelJS on Windows (Try ES6 on Windows)

13
Running BabelJS on Windows Kobkrit Viriyayudhakorn, Ph.D. CEO of iApp Technology Limited. [email protected] http://www.kobkrit.com

Transcript of Running BabelJS on Windows (Try ES6 on Windows)

Running BabelJS on Windows

Kobkrit Viriyayudhakorn, Ph.D. CEO of iApp Technology Limited.

[email protected] http://www.kobkrit.com

How to try ES6 and Beyond with on Windows

(1) Open Command Line with “Run as Administrator”

(2) Create Directory at C:\es6 and then run “npm init”

(3) Press Enter Many Times Until All Questions are Answered

(4) npm install --save-dev babel-cli babel-preset-stage-0

(4) notepad link.cmd

(5) Type “doskey babel-node=.\node_modules\.bin\babel-node $*” and hit file > save

(6) Go back to command line, type “link.cmd”

(7) echo {"presets":["stage-0"]} > .babelrc

(8) notepad 1.js

(9) Type down some ES6 code, e.g., console.log(‘Hello World!’); + Hit Save

(10) babel-node 1.js

Alias is not persistence!• If you closed the command line windows, enter c:

\es6 again, and always run link.cmd

• Open command line program

• cd c:\es6

• link.cmd

• babel-node somefile.js