Creating a Local Plugin
If a plugin is only relevant to your specific use-case, or if you’re developing a plugin and want a simpler workflow, a locally defined plugin is a convenient way to create and manage your plugin code.
Place the code in the
plugins folder in the root of your project like this:
NOTE: You still need to add the plugin to your
gatsby-config.js. There is no auto-detection of local plugins.
NOTE: For the plugin to be discovered, the plugin’s root folder name is the value that needs to be referenced in order to load it (not its name in its package.json file). For example, in the above structure, the correct way to load the plugin is:
gatsby-* files, the code is not processed by Babel. If you want
can place the files in a
src subfolder and build them to the plugin folder
Edit this page on GitHub