mirror of
https://github.com/facebook/react.git
synced 2026-02-26 02:54:59 +00:00
[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
This commit is contained in:
committed by
GitHub
parent
b354bbd2d2
commit
bd76b456c1
@@ -361,6 +361,7 @@ function startServer(
|
||||
response.end(
|
||||
backendFile.toString() +
|
||||
'\n;' +
|
||||
`var ReactDevToolsBackend = typeof ReactDevToolsBackend !== "undefined" ? ReactDevToolsBackend : require("ReactDevToolsBackend");\n` +
|
||||
`ReactDevToolsBackend.initialize(undefined, undefined, undefined, ${componentFiltersString});` +
|
||||
'\n' +
|
||||
`ReactDevToolsBackend.connectToDevTools({port: ${port}, host: '${host}', useHttps: ${
|
||||
|
||||
@@ -44,6 +44,7 @@ module.exports = {
|
||||
// This name is important; standalone references it in order to connect.
|
||||
library: 'ReactDevToolsBackend',
|
||||
libraryTarget: 'umd',
|
||||
umdNamedDefine: true,
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
|
||||
Reference in New Issue
Block a user