Summary:
Hoping that this will fix our docs build.
Note that I also had to fix a syntax error in `extending/loading-custom-plugins.mdx` that
broke the build with:
```
SyntaxError: /Users/realpassy/fbsource/xplat/sonar/docs/extending/loading-custom-plugins.mdx: Expected corresponding JSX closing tag for <admonition>. (10:10)
8 | <FbInternalOnly>
9 | <admonition {...{"type":"caution"}}><p parentName="admonition">{`Within Meta, plugins sources are stored and loaded from `}<inlineCode parentName="p">{`~/fbsource/xplat/sonar/desktop/plugins`}</inlineCode>{`, in which case no further configuration is needed.`}</p><p parentName="admonition">{`If your team uses Flipper plugins that are stored outside `}<inlineCode parentName="p">{`fbsource`}</inlineCode>{`, please follow your team specific instructions.
> 10 | ::::`}</p></FbInternalOnly><p parentName="admonition">{`Flipper loads and runs plugins it finds in a configurable location. The paths searched are specified in `}<inlineCode parentName="p">{`~/.flipper/config.json`}</inlineCode>{`. These `}<inlineCode parentName="p">{`pluginPaths`}</inlineCode>{` should contain one folder for each of the plugins it stores.`}</p><p parentName="admonition">{`An example config setting and plugin file structure is shown below:`}</p><p parentName="admonition"><inlineCode parentName="p">{`~/.flipper/config.json`}</inlineCode>{`:`}</p><pre parentName="admonition"><code parentName="pre" {...{"className":"language-bash"}}>{`{
| ^
11 | ...,
12 | "pluginPaths": ["~/flipper-plugins"]
13 | }
client (webpack 5.74.0) compiled with 1 error
```
Reviewed By: ivanmisuno
Differential Revision: D43767006
fbshipit-source-id: 64288d63c305bc9a9c9b797110889a703c7dcfee
50 lines
1.3 KiB
Plaintext
50 lines
1.3 KiB
Plaintext
---
|
|
id: loading-custom-plugins
|
|
title: Dynamically Loading Plugins
|
|
---
|
|
|
|
<FbInternalOnly>
|
|
|
|
:::caution
|
|
Within Meta, plugins sources are stored and loaded from `~/fbsource/xplat/sonar/desktop/plugins`, in which case no further configuration is needed.
|
|
|
|
If your team uses Flipper plugins that are stored outside `fbsource`, please follow your team specific instructions.
|
|
:::
|
|
|
|
</FbInternalOnly>
|
|
|
|
Flipper loads and runs plugins it finds in a configurable location. The paths searched are specified in `~/.flipper/config.json`. These `pluginPaths` should contain one folder for each of the plugins it stores.
|
|
|
|
An example config setting and plugin file structure is shown below:
|
|
|
|
`~/.flipper/config.json`:
|
|
|
|
```bash
|
|
{
|
|
...,
|
|
"pluginPaths": ["~/flipper-plugins"]
|
|
}
|
|
```
|
|
|
|
Plugin File example structure:
|
|
|
|
```
|
|
~ flipper-plugins/
|
|
my-plugin/
|
|
package.json
|
|
src/index.tsx
|
|
dist/bundle.js
|
|
```
|
|
|
|
<OssOnly>
|
|
|
|
:::note
|
|
When using `npx flipper-pkg init` for scaffolding, as explained in the [tutorial](../tutorial/intro.mdx) or on the next page, the path should be configured automatically for you in most cases.
|
|
:::
|
|
|
|
</OssOnly>
|
|
|
|
Typically, the above setup is only needed if you are developing plugins.
|
|
|
|
To consume plugins, it is recommended to use one of the existing [distribution mechanisms](plugin-distribution.mdx)
|