Skip to content

util._extend deprecation warning with browser-sync 3.0.3 and NodeJS 22.9.0 #2091

@jupelexv

Description

@jupelexv

Issue details

browser-sync (version 3.0.3) is using http-proxy version 1.18.1 which causes deprecation warning with NodeJS 22.9.0:

(node:5602) [DEP0060] DeprecationWarning: The `util._extend` API is deprecated. Please use Object.assign() instead.
    at ProxyServer.<anonymous> (/Users/juho/Projects/<project>/node_modules/http-proxy/lib/http-proxy/index.js:50:26)
    at handle (/Users/juho/Projects/<project>/node_modules/browser-sync/dist/server/proxy-server.js:77:23)
    at call (/Users/juho/Projects/<project>/node_modules/connect/index.js:239:7)
    at next (/Users/juho/Projects/<project>/node_modules/connect/index.js:183:5)
    at next (/Users/juho/Projects/<project>/node_modules/connect/index.js:161:14)
    at next (/Users/juho/Projects/<project>/node_modules/connect/index.js:161:14)
    at respModifierMiddleware (/Users/juho/Projects/<project>/node_modules/resp-modifier/index.js:80:9)
    at call (/Users/juho/Projects/<project>/node_modules/connect/index.js:239:7)
    at next (/Users/juho/Projects/<project>/node_modules/connect/index.js:183:5)
    at /Users/juho/Projects/<project>/node_modules/browser-sync/dist/snippet.js:76:13
    at call (/Users/juho/Projects/<project>/node_modules/connect/index.js:239:7)
    at next (/Users/juho/Projects/<project>/node_modules/connect/index.js:183:5)
    at next (/Users/juho/Projects/<project>/node_modules/connect/index.js:161:14)
    at Function.handle (/Users/juho/Projects/<project>/node_modules/connect/index.js:186:3)
    at Server.app (/Users/juho/Projects/<project>/node_modules/connect/index.js:51:37)
    at Server.<anonymous> (/Users/juho/Projects/<project>/node_modules/engine.io/build/server.js:656:34)

The warning likely happens in http-proxy/lib/http-proxy/http-proxy/index.js at line 2: extend = require('util')._extend, (https://github.com/http-party/node-http-proxy/blob/9b96cd725127a024dabebec6c7ea8c807272223d/lib/http-proxy/index.js#L2C5-L2C41).
This expression has been deprecated since NodeJS 22.0.0.
I did not find this issue on any other modules listed in the error message.

There's already an existing issue and suggested solution in http-proxy repository, but has not been applied yet.
Also, worth noting that the latest version ofhttp-proxy was released 4 years ago, so not sure if the whole module has been deprecated.

One suggestion could be using @refactorjs/http-proxy, which is supposed to be a refactored project of http-proxy.

Please specify which version of Browsersync, node and npm you're running

  • Browsersync [3.0.3]
  • Node [22.9.0]
  • Npm [10.8.3]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions