Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 19, 2025

The browserReload function throws TypeError: r is not a function when invoked without a callback parameter, which can occur in certain gulp task compositions.

Changes

  • Added type guard before invoking the done callback in browserReload
function browserReload(done) {
  server.reload();
  
  if (typeof done === 'function') {
    done();
  }
}

This makes the callback parameter effectively optional, preventing the error while maintaining backward compatibility with existing code that passes callbacks.

Original prompt

This section details on the original issue you should resolve

<issue_title>TypeError: r is not a function</issue_title>
<issue_description>Despite the fact that it works just fine, while reloading it complains:

TypeError: r is not a function
at browserReload (./node_modules/@forward-software/gulp-browser-sync/dist/index.js:1:163)

So not exactly a bug but just FYI, cheers!
</issue_description>

<agent_instructions>The issue has been reported while using the gulp-browser-sync plugin.
Try to understand what the issue stems from and find a fix to avoid it, even if it's non-blocking.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: panz3r <1754457+panz3r@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix TypeError in browser reload function Fix TypeError when browserReload called without callback Dec 19, 2025
Copilot AI requested a review from panz3r December 19, 2025 10:58
@panz3r panz3r marked this pull request as ready for review December 19, 2025 18:14
@panz3r panz3r enabled auto-merge (squash) December 19, 2025 18:16
@panz3r panz3r disabled auto-merge December 19, 2025 19:04
@panz3r panz3r merged commit 4090562 into main Dec 19, 2025
10 checks passed
@panz3r panz3r deleted the copilot/fix-typeerror-browser-reload branch December 19, 2025 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TypeError: r is not a function

2 participants