Skip to content

Commit

Permalink
Inspector proxy: Fix "Buffer() is deprecated" warning (facebook#43686)
Browse files Browse the repository at this point in the history
Summary:

Under Node 20, the use of `new Buffer(string)` is deprecated and logs a warning. This replaces it with the recommended `Buffer.from(string)`.

Changelog: 
[General][Fixed] FIx "Buffer() is deprecated" warning from debugger proxy.

Reviewed By: huntie

Differential Revision: D55472025
  • Loading branch information
robhogan authored and facebook-github-bot committed Mar 28, 2024
1 parent 4841373 commit 900b0a5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/dev-middleware/src/inspector-proxy/Device.js
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ export default class Device {
// $FlowFixMe[cannot-write]
payload.params.sourceMapURL =
'data:application/json;charset=utf-8;base64,' +
new Buffer(sourceMap).toString('base64');
Buffer.from(sourceMap).toString('base64');
} catch (exception) {
this.#sendErrorToDebugger(
`Failed to fetch source map ${params.sourceMapURL}: ${exception.message}`,
Expand Down

0 comments on commit 900b0a5

Please sign in to comment.