Search code examples
ionic-frameworkgulpionic2ionic3

Gulp `serve:before` tasks not running in Ionic CLI v 3


Gulp serve:before tasks are not running in the Ionic CLI v3. They used to run well in Ionic CLI 2 and Ionic CLI 1.

gulp.task('serve:before', ['watch']); This is the task. My app uses Ionic 1 and I did the necessary configurations and it is running well on Ionic CLI 3 upon ionic serve but not the gulp task serve:before is not running.


Solution

  • I believe you can update your code from:

    gulp.task('serve:before', ['watch'])
    

    to

    gulp.task('ionic:watch:before', ['watch'])
    

    If you install the ionic gulp plugin here.

    My task also had a 'default' task, which can just be included alongside the watch task as before, so mine currently looks like this:

    gulp.task('ionic:watch:before', ['default', 'watch'])
    

    The weird thing is that it does not show any of the code being compiled on startup as it used to, but it does seem to actually do this.

    =======================================

    Update for ionic CLI 4

    I had to update the task name to the following in ionic cli 4:

    gulp.task('ionic:serve:before', ['default', 'watch'])