gulpjs / gulp

A toolkit to automate & enhance your workflow
https://gulpjs.com
MIT License
32.98k stars 4.23k forks source link

src() doesn't work with wildcards (4.0.2 -> 5.0.0) #2811

Open lik3as opened 2 months ago

lik3as commented 2 months ago

What were you expecting to happen?

all html files in src/html/**/*.html to be in the dist/ directory

What actually happened?

none of the files were in the dist/ dir

Please give us a sample of your gulpfile

gulp.task("build-html", async function () {
  return gulp
    .src("src/html/**/*.html")
    .pipe(
      fileinclude({
        context: layout,
        prefix: "@@",
        basepath: "@file",
        indent: true,
      })
    )
    .pipe(gulp.dest("dist"));
});

Terminal output / screenshots

gulpjs1

$ yarn gulp build-html
$ ls dist/

Please provide the following information:

Additional information

When using 4.0.2, the program works as expected. So the current solution is downgrading the gulp version.

emimoun2 commented 2 months ago

i have the same issue its copy part of file

phated commented 2 months ago

What happens if you remove async on your function? You can't combine promise-returning and stream-returning functions.

lik3as commented 2 months ago

What happens if you remove async on your function? You can't combine promise-returning and stream-returning functions.

this happens: [15:34:34] The following tasks did not complete: build-html [15:34:34] Did you forget to signal async completion? error Command failed with exit code 1.

(i accidentally closed the issue)

phated commented 2 months ago

Sounds like your fileinclude plugin is broken, maybe it is emitting an error that's being lost.

Gulp 5 changed the underlying stream implementation and misbehaving stream implementations aren't supported anymore.

lik3as commented 2 months ago

I tested and the error still occurs when I remove fileInclude: image

Also, it runs normally when using the callback (but still doesn't include all glob matching files) image

redmnat commented 2 months ago

I have the exact same issue coming from 4.0.2. Using a simple src to dest stream fails with "Did you forget to signal async completion?" when using a wildcard.

Works: gulp.src('src/index.html')

Fails: gulp.src('src/*.html')

ealcantara22 commented 2 weeks ago

I have the same issue, I started migrating to gulp v5 and faced this.

gulp: v5.0.0
node: v20.14.0
npm: 10.7.0
macOS: 14.6.1 Sonoma
thomjjames commented 2 weeks ago

Also getting this with Gulp 5, downgrading to version 4 and it seems to work ok:

yarn add gulp@4