LoginSignup
1
0

More than 5 years have passed since last update.

Gulp v3 -> v4

Last updated at Posted at 2019-02-10

webpack4を使おうとしたら、NodeJSのバージョンアップが必要になり、芋づる式にgulpもv4になって、既存スクリプトの修正が必要になったので、メモる。

  • 依存タスクの書き方が変更された (参考: https://satoyan419.com/gulp-v4/)
    • タスク名のリスト → gulp.seriesとgulp.seriesを使う
  • "apply..."のエラーが出る場合 (参考: https://zzz.buzz/2016/11/19/gulp-4-0-upgrade-guide/)
    • グローバルのgulpとローカルのgulpのバージョン不整合が原因らしい
    • グローバルのgulpをいったんアンインストールして再インストール
  • タスクから何か返さないといけない
    • ストリームをreturnで返す or コールバック関数を引数で受けて、最後にそれを呼ぶ
gulp.task('xyz', function() {
  return gulp.src(...)...pipe(...);
}

or

gulp.task('xyz', function(cb) {
  ....
  cb();
}
1
0
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
0