question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Did gulp.src allowEmpty default change in Gulp 4?

See original GitHub issue

I’m trying to upgrade from gulp 3.9.1 to gulp 4.0.0 but my gulpfile is breaking on gulp.src when there are no files matched.

I can fix this by adding the allowEmpty: true option, which appears to be new in gulp 4.

My question is, did gulp 3 allow empty matches by default?

If the answer is yes then the behaviour of gulp.src has changed between gulp 3 and gulp 4, and I think this should be documented somewhere. If it is not in the documentation, I am happy to submit a PR.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
max-cicommented, Jan 8, 2019

Yes and it’s documented.

https://gulpjs.com/docs/en/api/src#errors

When the globs argument can only match one file (such as foo/bar.js) and no match is found, throws an error with the message, “File not found with singular glob”. To suppress this error, set the allowEmpty option to true.

When an invalid glob is given in globs, throws an error with the message, “Invalid glob argument”.

1reaction
phatedcommented, Jan 9, 2019

The gulp 4 docs aren’t written from the perspective of people upgrading. They are the source of truth for that version. Perhaps you’ve seen our open issue for a Migration Guide?

Read more comments on GitHub >

github_iconTop Results From Across the Web

gulp 4.0 allowEmpty : true is not working for empty array
The allowEmpty option just suppresses the error that is thrown if no match is found—it doesn't change what can be passed in the...
Read more >
src() - gulp.js
name type default buffer boolean function true read boolean function true since date timestamp function
Read more >
Easily Improve Front-end ASP.NET Core App Development ...
Gulp is a toolkit that helps web developers automate many development tasks such as minification and file conversion.
Read more >
How to Migrate to Gulp.js 4.0 - SitePoint
Learn how to migrate to Gulp.js 4.0 and update your 3.0 gulpfile.js configurations. Find out what you need to know about changes in...
Read more >
gulpfile error when running gulp command [#3150498] - Drupal
src and have gulp version 4 install on system. Below is a sample code, gulp.src('app/scripts.js', { allowEmpty: true }) .pipe(..
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found