@samitouri / QOS-React-2 / commits / bd76b456c1

[DevTools] Fix ReactDevToolsBackend module for AMD (#35891)

## Summary For apps that use AMD, we need to actually `require()` the ReactDevToolsBackend and load it from the AMD module cache. This adds a check for the case where the `ReactDevToolsBackend` isn't defined globally, and so we load it with `require()`. ## How did you test this change? Tested through https://github.com/facebook/react/pull/35886

Mushaheed Kapadia committed Feb 24, 2026 at 10:27 UTC bd76b456c127222f59888953348d40cf8f03e3a0
2 files changed +2
packages/react-devtools-core/src/standalone.js
+1
@@ -361,6 +361,7 @@ function startServer(
361 response.end(
362 backendFile.toString() +
363 '\n;' +
364 + `var ReactDevToolsBackend = typeof ReactDevToolsBackend !== "undefined" ? ReactDevToolsBackend : require("ReactDevToolsBackend");\n` +
365 `ReactDevToolsBackend.initialize(undefined, undefined, undefined, ${componentFiltersString});` +
366 '\n' +
367 `ReactDevToolsBackend.connectToDevTools({port: ${port}, host: '${host}', useHttps: ${
packages/react-devtools-core/webpack.backend.js
+1
@@ -44,6 +44,7 @@ module.exports = {
44 // This name is important; standalone references it in order to connect.
45 library: 'ReactDevToolsBackend',
46 libraryTarget: 'umd',
47 + umdNamedDefine: true,
48 },
49 resolve: {
50 alias: {