LoginSignup
4
4

More than 5 years have passed since last update.

Babelをローカルにインストールしてみる

Last updated at Posted at 2015-04-09

https://babeljs.io/docs/learn-es6/ のコードを試してたら http://www.es6fiddle.net/ で試せない例が出てきたのでローカル環境にBabelを入れることにしました。

Using Babel

https://babeljs.io/docs/using-babel/
Node.js・npmが必要です。
npm install babel -g を実行。

テストファイル作成

script.js
console.log("Hello Babel");

https://babeljs.io/docs/usage/cli/#babel-node
babel-nodeを実行

C:\workspace\babel>babel-node script.js
Hello Babel

簡単!

コンパイルする場合

https://babeljs.io/docs/usage/cli/#compile-directories
ソースディレクトリをコンパイルします

C:\workspace\babel>babel src --out-dir dest
src\lib\math.js -> dest\lib\math.js
src\script.js -> dest\script.js

C:\workspace\babel>
4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4