gatsby: page creator: can't override default options of gatsby

Gatsby 2.3.4 (latest) here, using the “ignore” option recently added to page creator plugin. see also https://github.com/gatsbyjs/gatsby/pull/11304

It seems this plugin is “added” to the existing gatsby default one. I’d expect this config replace the default gatsby one as it’s using the exact same path.

The usecase is that I’d like to keep a /pages folder, but ignore the components being in /components folders.

What I’d like:

  • pages/payment/index.tsx should be a page
  • pages/payment/components/creditCardInput.tsx should be ignored

I expect the following config to match nothing, but actually adding the following did not produce any effect at all:

    {
      resolve: `gatsby-plugin-page-creator`,
      options: {
        path: `${__dirname}/src/pages`,
        ignore: {
          patterns: [`**/*`],
        },
      },
    },

A workaround is to simply not use the /pages folder, I can simply rename it to /page or something else, so that gatsby default config gets ignored, but this renaming seems a bit annoying to me.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 4
  • Comments: 15 (12 by maintainers)

Most upvoted comments

That’s the downside of gatsby-plugin-page-creator it’s used to give users the option to easily mark other directories as pages directories.

It’s not made to use on the default directory, sadly we will not fix this or enable this feature. Renaming your directory is the best solution at this time. You could always go for src/app/pages if you really want to keep the directory name 😛