You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR adds support for extracting hook names to the standalone version of React DevTools. The approach is similar to the approach in #22263:
Add a new webpack entry point for hook names
Pass a function to lazy load the hook names module generated by webpack to the standalone instance of DevTools.
Additionally:
Enable nodeIntegrationInWorker in the Electron BrowserWindow to ensure that the worker that parses hook names has access to Node.
When testing our standalone test fixture in Safari, I noticed that we were unable to parse hook names because the source file where the components are defined is an HTML file, and babel parser fails to parse this file. I added a follow up issue to address this: #22319, and in this commit added handling to parsing errors to produce a slightly better error message in the console.
Test Plan
yarn flow
yarn test
yarn test-build-devtools
hook names still work on manual test of browser extension on a few different apps (code sandbox, create-react-app, internally).
hook names appear in standalone version of DevTools, testing with Safari
hook names appear in standalone version of DevTools, testing with RN (#22370):
🔍 The Electron documentation confirms that nodeIntegrationInWorker must be set to true in webPreferences to enable Node.js features in Web Workers, which is required for the standalone DevTools to extract hook names via a worker.
🔍 The standalone version of React DevTools now supports extracting hook names by adding a new webpack entry point and enabling nodeIntegrationInWorker in Electron to lazy load the hook names module.
🔍 The standalone version of React DevTools now supports extracting hook names by adding a new webpack entry point and enabling nodeIntegrationInWorker in Electron's BrowserWindow for lazy loading the hook names module.
🔍 The standalone version of React DevTools now supports extracting hook names by adding a new webpack entry point and enabling lazy loading of the hook names module, similar to the approach in PR #22263.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for extracting hook names to the standalone version of React DevTools. The approach is similar to the approach in #22263:
Additionally:
nodeIntegrationInWorkerin the ElectronBrowserWindowto ensure that the worker that parses hook names has access to Node.Test Plan