0

I can't figure out why a task in Gulp starts but doesn't end automatically
The task code is as follows:

import del from 'del';
import { projectFolder } from '../config';

const cleanRoot = () => {
  return del(projectFolder);
};

export default cleanRoot;

I run the command and like this it is written in the console:

C:\Users\sy\Desktop\temp>npm run clean
> project-name@1.0.0 clean
> gulp cleanRoot
[16:07:34] Requiring external module @babel/register
[16:07:39] Using gulpfile ~\Desktop\temp\gulpfile.babel.js
[16:07:39] Starting 'cleanRoot'...
[16:07:39] Finished 'cleanRoot' after 60 ms

And everything after Finished hangs the cursor on the next line and nothing happens :)

SineYlo
  • 85
  • 1
  • 1
  • 4
  • Have you tried `return del(projectFolder, { force: true });`? The option `force` is required when deleting something outside the current directory. – GOTO 0 Dec 07 '21 at 09:37
  • @GOTO0 Now I tried it 3 times, nothing came of it :(. The funny thing is that this is + – on all tasks, and it is not clear why. – SineYlo Dec 07 '21 at 09:57

1 Answers1

1

When you're creating gulp tasks, gulp injects callback as a first argument of your task function that will notify gulp that your task has ended.

const cleanRoot = (cb) => {
  del(projectFolder);
  cb();
};
Terminat
  • 1,199
  • 5
  • 21