Fixed web extensions
Brian Vaughn committed
Aug 14, 2019 at 10:33 UTC
58b39c60db353d758b741e2deaa303c1651d8cf0
5 files changed
+53
-35
packages/react-devtools-extensions/src/main.js
+45
-35
@@ -227,47 +227,57 @@ function createPanelIfReactLoaded() {
227
let currentPanel = null;
228
let needsToSyncElementSelection = false;
229
230
- chrome.devtools.panels.create('⚛ Components', '', 'panel.html', panel => {
231
- panel.onShown.addListener(() => {
232
- if (needsToSyncElementSelection) {
233
- needsToSyncElementSelection = false;
234
- bridge.send('syncSelectionFromNativeElementsPanel');
235
- }
230
+ chrome.devtools.panels.create(
231
+ '⚛ Components',
232
+ '',
233
+ 'panel.html',
234
+ extensionPanel => {
235
+ extensionPanel.onShown.addListener(panel => {
236
+ if (needsToSyncElementSelection) {
237
+ needsToSyncElementSelection = false;
238
+ bridge.send('syncSelectionFromNativeElementsPanel');
239
+ }
240
237
- if (currentPanel === panel) {
238
- return;
239
- }
241
+ if (currentPanel === panel) {
242
+ return;
243
+ }
244
241
- currentPanel = panel;
242
- componentsPortalContainer = panel.container;
245
+ currentPanel = panel;
246
+ componentsPortalContainer = panel.container;
247
244
- if (componentsPortalContainer != null) {
245
- ensureInitialHTMLIsCleared(componentsPortalContainer);
246
- render('components');
247
- panel.injectStyles(cloneStyleTags);
248
- }
249
- });
250
- panel.onHidden.addListener(() => {
251
- // TODO: Stop highlighting and stuff.
252
- });
253
- });
248
+ if (componentsPortalContainer != null) {
249
+ ensureInitialHTMLIsCleared(componentsPortalContainer);
250
+ render('components');
251
+ panel.injectStyles(cloneStyleTags);
252
+ }
253
+ });
254
+ extensionPanel.onHidden.addListener(panel => {
255
+ // TODO: Stop highlighting and stuff.
256
+ });
257
+ },
258
+ );
259
255
- chrome.devtools.panels.create('⚛ Profiler', '', 'panel.html', panel => {
256
- panel.onShown.addListener(() => {
257
- if (currentPanel === panel) {
258
- return;
259
- }
260
+ chrome.devtools.panels.create(
261
+ '⚛ Profiler',
262
+ '',
263
+ 'panel.html',
264
+ extensionPanel => {
265
+ extensionPanel.onShown.addListener(panel => {
266
+ if (currentPanel === panel) {
267
+ return;
268
+ }
269
261
- currentPanel = panel;
262
- profilerPortalContainer = panel.container;
270
+ currentPanel = panel;
271
+ profilerPortalContainer = panel.container;
272
264
- if (profilerPortalContainer != null) {
265
- ensureInitialHTMLIsCleared(profilerPortalContainer);
266
- render('profiler');
267
- panel.injectStyles(cloneStyleTags);
268
- }
269
- });
270
- });
273
+ if (profilerPortalContainer != null) {
274
+ ensureInitialHTMLIsCleared(profilerPortalContainer);
275
+ render('profiler');
276
+ panel.injectStyles(cloneStyleTags);
277
+ }
278
+ });
279
+ },
280
+ );
281
282
chrome.devtools.network.onNavigated.removeListener(checkPageForReact);
283
packages/react-devtools-extensions/webpack.backend.js
+2
@@ -30,7 +30,9 @@ module.exports = {
30
resolve: {
31
alias: {
32
react: resolve(builtModulesDir, 'react'),
33
+ 'react-debug-tools': resolve(builtModulesDir, 'react-debug-tools'),
34
'react-dom': resolve(builtModulesDir, 'react-dom'),
35
+ 'react-is': resolve(builtModulesDir, 'react-is'),
36
scheduler: resolve(builtModulesDir, 'scheduler'),
37
},
38
},
packages/react-devtools-extensions/webpack.config.js
+2
@@ -35,7 +35,9 @@ module.exports = {
35
resolve: {
36
alias: {
37
react: resolve(builtModulesDir, 'react'),
38
+ 'react-debug-tools': resolve(builtModulesDir, 'react-debug-tools'),
39
'react-dom': resolve(builtModulesDir, 'react-dom'),
40
+ 'react-is': resolve(builtModulesDir, 'react-is'),
41
scheduler: resolve(builtModulesDir, 'scheduler'),
42
},
43
},
packages/react-devtools-inline/webpack.config.js
+2
@@ -31,7 +31,9 @@ module.exports = {
31
},
32
externals: {
33
react: 'react',
34
+ 'react-debug-tools': 'react-debug-tools',
35
'react-dom': 'react-dom',
36
+ 'react-is': 'react-is',
37
scheduler: 'scheduler',
38
},
39
plugins: [
packages/react-devtools-shell/webpack.config.js
+2
@@ -35,6 +35,8 @@ const config = {
35
alias: {
36
react: resolve(builtModulesDir, 'react'),
37
'react-dom': resolve(builtModulesDir, 'react-dom'),
38
+ 'react-debug-tools': resolve(builtModulesDir, 'react-debug-tools'),
39
+ 'react-is': resolve(builtModulesDir, 'react-is'),
40
scheduler: resolve(builtModulesDir, 'scheduler'),
41
},
42
},