Bundle headless plugins

Summary: Current temporary limitations: all headless plugins are bundled with Flipper.

Reviewed By: antonk52

Differential Revision: D36098168

fbshipit-source-id: c58abe41776157258a5c39a80a5c1a33cf3f42c5
This commit is contained in:
Andrey Goncharov
2022-05-10 05:13:24 -07:00
committed by Facebook GitHub Bot
parent 1f2f799772
commit a6d7f98cfd
10 changed files with 84 additions and 11 deletions

View File

@@ -16,9 +16,16 @@ import {
tryReplaceGlobalReactUsage,
} from './replace-flipper-requires';
const sourceRootDir = resolve(__dirname, '../..');
const pluginRootDir = resolve(__dirname, '../../plugin');
// do not apply this transform for these paths
const EXCLUDE_PATHS = ['relay-devtools/DevtoolsUI'];
function isExcludedPath(path: string) {
// Replace requires and React for plugins, but not for the Flipper core code which can access bundled React and other Flipper packages
if (path.startsWith(sourceRootDir) && !path.startsWith(pluginRootDir)) {
return true;
}
for (const epath of EXCLUDE_PATHS) {
if (path.indexOf(epath) > -1) {
return true;