LoginSignup
1
1

More than 5 years have passed since last update.

ローカルで気軽に ES2015 を試す方法。 `node hoge.js` のノリで。

Last updated at Posted at 2017-05-23

とても簡単です。

パッケージを2ついれて、babel-node コマンドうてばできます。

$ mkdir workspace; cd $_
$ npm init
$ npm install --save-dev babel-cli
$ npm install --save-dev babel-preset-es2015

$ touch hoge1.js hoge2.js
hoge1.js
import foo from './hoge2'
foo.say()
hoge2.js
export default {
  say(){
    console.log('Hello ES2015')
  }
}
$ node_modules/.bin/babel-node hoge1.js
Hello ES2015

ありがとうございました。 🍀

参考:
- https://mae.chab.in/archives/2845
- https://babeljs.io/docs/usage/cli/

1
1
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
1
1