Support globally installed React DevTools
Summary: - Support loading globally installed DevTools Background: 1. Initially, I wanted to use react-devtools-core as before. react-devtools-core standalone contains quite a few imports of node.js APIs. After [a conversation with Brian](https://fb.workplace.com/groups/react.devtools/permalink/3131548550392044), I pivoted to react-devtools-inline 2. Technical design doc of react-devtools-inline integration: https://docs.google.com/document/d/1STUSUhXzrW_KkvqSu7Ge-rxjVFF7oU3_NbwzimkO_Z4 3. We support usage of globally installed devtools. Code of react-devtools-inline is not ready to be used by the browser as is. We need to bundle it and substitute React and ReactDOM imports with the globals. 4. As we can't pre-compile what users install globally, we need to bundle global devtools on demand, 5. I tried re-using our Metro bundling pipeline initially, but gave up after fighting it for 2 days. Included, `rollup` instead. 6. Size of a `tgz` archive with a plugin is 2.1MB allow-large-files Reviewed By: mweststrate Differential Revision: D34968770 fbshipit-source-id: 352299964ccc195b8677dbda47db84ffaf38737b
This commit is contained in:
committed by
Facebook GitHub Bot
parent
68aec1df60
commit
ba9a80545d
@@ -16,6 +16,8 @@ import {
|
||||
import {PluginDefinition} from '../plugin';
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import ReactDOMClient from 'react-dom/client';
|
||||
import ReactIs from 'react-is';
|
||||
import {
|
||||
registerPlugins,
|
||||
addGatekeepedPlugins,
|
||||
@@ -61,6 +63,8 @@ export default async (store: Store, _logger: Logger) => {
|
||||
// this list should match `replace-flipper-requires.tsx` and the `builtInModules` in `desktop/.eslintrc`
|
||||
globalObject.React = React;
|
||||
globalObject.ReactDOM = ReactDOM;
|
||||
globalObject.ReactDOMClient = ReactDOMClient;
|
||||
globalObject.ReactIs = ReactIs;
|
||||
globalObject.Flipper = deprecatedExports;
|
||||
globalObject.FlipperPlugin = FlipperPluginSDK;
|
||||
globalObject.Immer = Immer;
|
||||
|
||||
Reference in New Issue
Block a user