vite icon indicating copy to clipboard operation
vite copied to clipboard

The `util._extend` API is deprecated warning from `http-proxy` dependency in Node 22

Open bayasdev opened this issue 1 month ago • 0 comments

Describe the bug

When running a Vite React TypeScript app I get the following deprecation warning:

(node:4364) [DEP0060] DeprecationWarning: The `util._extend` API is deprecated. Please use Object.assign() instead.
    at ProxyServer.<anonymous> (file:///Users/victor/redacted/node_modules/vite/dist/node/chunks/dep-cNe07EU9.js:63161:27)
    at viteProxyMiddleware (file:///Users/victor/redacted/node_modules/vite/dist/node/chunks/dep-cNe07EU9.js:63494:23)
    at call (file:///Users/victor/redacted/node_modules/vite/dist/node/chunks/dep-cNe07EU9.js:42944:7)
    at next (file:///Users/victor/redacted/node_modules/vite/dist/node/chunks/dep-cNe07EU9.js:42888:5)
    at viteCachedTransformMiddleware (file:///Users/victor/redacted/node_modules/vite/dist/node/chunks/dep-cNe07EU9.js:63642:9)
    at call (file:///Users/victor/redacted/node_modules/vite/dist/node/chunks/dep-cNe07EU9.js:42944:7)
    at next (file:///Users/victor/redacted/node_modules/vite/dist/node/chunks/dep-cNe07EU9.js:42888:5)
    at cors (file:///Users/victor/redacted/node_modules/vite/dist/node/chunks/dep-cNe07EU9.js:43416:7)
    at file:///Users/victor/redacted/node_modules/vite/dist/node/chunks/dep-cNe07EU9.js:43452:17
    at originCallback (file:///Users/victor/redacted/node_modules/vite/dist/node/chunks/dep-cNe07EU9.js:43442:15)

There's already PR that fixes this warning https://github.com/http-party/node-http-proxy/pull/1666 but the http-proxy package seems to not be well maintained as its last release dates back from 2020.

I think a Vite side patch could be implemented like this one https://github.com/cap-js-community/odata-v2-adapter/pull/46

Reproduction

n/a

Steps to reproduce

Run a project with proxy setup in vite.config.ts using the yarn dev command

System Info

System:
    OS: macOS 14.4.1
    CPU: (11) arm64 Apple M3 Pro
    Memory: 341.27 MB / 36.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.1.0 - ~/.volta/tools/image/node/22.1.0/bin/node
    Yarn: 1.22.21 - ~/.volta/tools/image/yarn/1.22.21/bin/yarn
    npm: 10.7.0 - ~/.volta/tools/image/node/22.1.0/bin/npm
  Browsers:
    Brave Browser: 124.1.65.126
    Chrome: 124.0.6367.156
    Safari: 17.4.1
  npmPackages:
    @vitejs/plugin-react-swc: ^3.6.0 => 3.6.0 
    vite: ^5.2.0 => 5.2.11

Used Package Manager

yarn

Logs

No response

Validations

bayasdev avatar May 10 '24 20:05 bayasdev