Skip to content

Commit 74a26e0

Browse files
committed
Reduce waterfall by inlining the async chunk
1 parent 820a831 commit 74a26e0

File tree

1 file changed

+7
-6
lines changed
  • packages/react-devtools-extensions/src/main

1 file changed

+7
-6
lines changed

packages/react-devtools-extensions/src/main/index.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {
2424
normalizeUrlIfValid,
2525
} from 'react-devtools-shared/src/utils';
2626
import {checkConditions} from 'react-devtools-shared/src/devtools/views/Editor/utils';
27+
import * as parseHookNames from 'react-devtools-shared/src/hooks/parseHookNames';
2728

2829
import {
2930
setBrowserSelectionFromReact,
@@ -40,6 +41,12 @@ import getProfilingFlags from './getProfilingFlags';
4041
import debounce from './debounce';
4142
import './requestAnimationFramePolyfill';
4243

44+
const resolvedParseHookNames = Promise.resolve(parseHookNames);
45+
// DevTools assumes this is a dynamically imported module. Since we outline
46+
// workers in this bundle, we can sync require the module since it's just a thin
47+
// wrapper around calling the worker.
48+
const hookNamesModuleLoaderFunction = () => resolvedParseHookNames;
49+
4350
function createBridge() {
4451
bridge = new Bridge({
4552
listen(fn) {
@@ -188,12 +195,6 @@ function createBridgeAndStore() {
188195
);
189196
};
190197

191-
// TODO (Webpack 5) Hopefully we can remove this prop after the Webpack 5 migration.
192-
const hookNamesModuleLoaderFunction = () =>
193-
import(
194-
/* webpackChunkName: 'parseHookNames' */ 'react-devtools-shared/src/hooks/parseHookNames'
195-
);
196-
197198
root = createRoot(document.createElement('div'));
198199

199200
render = (overrideTab = mostRecentOverrideTab) => {

0 commit comments

Comments
 (0)