Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Gatsby plugins with resolve #525

Closed
znarf opened this issue Feb 29, 2020 · 2 comments · Fixed by #573
Closed

Support Gatsby plugins with resolve #525

znarf opened this issue Feb 29, 2020 · 2 comments · Fixed by #573

Comments

@znarf
Copy link
Collaborator

znarf commented Feb 29, 2020

In the following file, https://github.com/badges/shields/blob/master/gatsby-config.js, gatsby-plugin-page-creator is not detected because it's set using a different syntax than what is currently expected.

 plugins: [
    {
      resolve: 'gatsby-plugin-page-creator',
      options: {
        path: `${__dirname}/frontend/pages`,
      },
    },
    'gatsby-plugin-react-helmet',
    'gatsby-plugin-catch-links',
    'gatsby-plugin-styled-components',
    'gatsby-plugin-remove-trailing-slashes',
    'gatsby-plugin-typescript',
@nagygergo
Copy link
Contributor

Also, this is a valid config too, so resolving the used plugins seems to be a harder task:

 'gatsby-plugin-sharp',
'gatsby-transformer-sharp',
{
      resolve: 'gatsby-transformer-remark',
      options: {
        plugins: [
          {
            resolve: 'gatsby-remark-relative-images',
            options: {
              name: 'uploads',
            },
          }]
     }
}

@nagygergo
Copy link
Contributor

Gatsby identifies the following elements as plugin entries:

  • gatsby-plugin-sharp
  • { resolve: 'gatsby-transformer-sharp', options: {} }
  • { resolve: 'gatsby-transformer-remark' }

Also there is an option for plugins to have plugins of their own. So the based on the above snippets I'd consider the following rules to find the used plugins:

  • Plugin entry must be an element of an array that is under a plugins key. So plugins: [<pluginEntry>].
  • Plugin entry must be one of the above shapes above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants