Option to load only specific plugins in dev mode
Summary: Currently we load all the plugins even if they are not required in dev mode, e.g. when you are developing a specific plugin. This diff adds an env var and command-line option to specify exact list of plugins to load. This makes dev mode startup faster and consume less memory. Reviewed By: passy Differential Revision: D24394146 fbshipit-source-id: 42a78c1ffb2632e657c2411e34e9c80fff18df3a
This commit is contained in:
committed by
Facebook GitHub Bot
parent
966d748ace
commit
2d9cf5a905
@@ -29,7 +29,21 @@ export async function getSourcePlugins(): Promise<PluginDetails[]> {
|
||||
entryPoints[key] = p[key];
|
||||
});
|
||||
}
|
||||
return Object.values(entryPoints);
|
||||
const allPlugins = Object.values(entryPoints);
|
||||
if (process.env.FLIPPER_ENABLED_PLUGINS) {
|
||||
const pluginNames = new Set<string>(
|
||||
process.env.FLIPPER_ENABLED_PLUGINS.split(',').map((x) =>
|
||||
x.toLowerCase(),
|
||||
),
|
||||
);
|
||||
return allPlugins.filter(
|
||||
(x) =>
|
||||
pluginNames.has(x.name) ||
|
||||
pluginNames.has(x.id) ||
|
||||
pluginNames.has(x.name.replace('flipper-plugin-', '')),
|
||||
);
|
||||
}
|
||||
return allPlugins;
|
||||
}
|
||||
async function entryPointForPluginFolder(
|
||||
pluginsDir: string,
|
||||
|
||||
Reference in New Issue
Block a user