LoginSignup
10
10

More than 5 years have passed since last update.

gulp を使わず watchify で監視しつつ babel

Posted at

呼吸をするように gulp を使ってたのでたまには npm scripts でやってみよっかなーと思ってやってみたら意外にいい感じだったのでメモ。

install package

必要なパッケージをインストール

  • browserify
  • watchify
  • babelify
  • babel-preset-es2015

あとはプリセット、プラグインはお好きなやつを。

$ npm install --save-dev browserify watchify babelify babel-preset-es2015

write .babelrc

.bablerc に以下を記述

{
"presets": ["es2015"]
}

もちろんプリセットは自分が好きな吐き出したいやつに変えられる。

npm scripts

npm scripts を記述

package.json
"scripts": {
    "dev": "watchify main.js -t babelify -o bundle.js"
}

watchifymain.jsbabelifytransform(-t) して ファイルに吐き出して( -obundle.js を作る。

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