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
fix(gatsby): Allow overriding options for default instance of gatsby-plugin-page-creator #17420
fix(gatsby): Allow overriding options for default instance of gatsby-plugin-page-creator #17420
Conversation
… specified options from gatsby-config.js
This is my first attempt at contributing to gatsbyjs, would really appreciate some feedback.. |
…ons specified in gatsby-config.js only if options.path matches src/pages
Hm, seems like this
Not sure what that could be, maybe unrelated to this? Wonder if master is currently passing... |
Yes @karlhorky. But when I try to run the same e2e test locally on my system, it passes all the tests without any issue.. |
Somehow at a first glimpse the code not do the expected... A) it overwrites the plugin options with default. But it should be otherwise. The default with the specific B) if there found the plugin with the same path it should not pushed a second time. As I understand the documentation of the plugin: a) it is by default activated (pushed to plugins) @wardpeet could confirm my assumptions? |
const pageCreatorPlugin = config.plugins.find( | ||
plugin => | ||
plugin.resolve === `gatsby-plugin-page-creator` && | ||
plugin.options.path.match(/src\/pages$/) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should not match only the last chars but the full path, because all path for this plugin are full path
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can be also ${__dirname}/myguides/src/pages
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the condition to override the defaults only if the path matches <program.directory>/src/pages
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thanks for picking this up @akshayymahajan 👍
Holy buckets, @akshayymahajan — we just merged your PR to Gatsby! 💪💜 Gatsby is built by awesome people like you. Let us say “thanks” in two ways:
If there’s anything we can do to help, please don’t hesitate to reach out to us: tweet at @gatsbyjs and we’ll come a-runnin’. Thanks again! |
Published in |
Description
Override the default options for gatsby-plugin-page-creator with options specified in gatsby-config.js
Related Issues
Fixes #17379