Files Gatsby Looks for in a Plugin
What files does Gatsby look for in a plugin?
All files are optional unless specifically marked as required.
package.json
— [required] this can be an empty object ({}
) for local plugins.name
is used to identify the plugin when it mutates Gatsby’s GraphQL data structure- if
name
isn’t set, the folder name for the plugin is used
- if
main
is the name of the file that will be loaded when your module is required by another application- if
main
isn’t set, a default name ofindex.js
will be used - if
main
isn’t set, it is recommended (but not required) to create an empty index.js file with the contents//no-op
(short for no-operation), as seen in this example plugin
- if
version
is used to manage the cache — if it changes, the cache is cleared- if
version
isn’t set, an MD5 hash of thegatsby-*
file contents is used to invalidate the cache - omitting the
version
field is recommended for local plugins
- if
keywords
is used to make your plugin discoverable- plugins published on the npm registry should have
gatsby
andgatsby-plugin
in thekeywords
field to be added to the Plugin Library
- plugins published on the npm registry should have
gatsby-browser.js
— usage details are in the browser API referencegatsby-node.js
— usage details are in the Node API referencegatsby-ssr.js
— usage details are in the SSR API reference