-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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): add error for missing config in theme #10739
Conversation
This will also |
Oh, I didn't realize main was optional. Yes, this will Perhaps we need to make it optional for themes then. ( If that is the intention, then we have a bug, but this example seems to imply that it is required: ChristopherBiscardi/gatsby-theme-minimal/gatsby-config.js.) /cc @ChristopherBiscardi because they said they are in the middle of a rewrite. |
It's optional for "main site" - I don't think it makes much sense for it to be optional for themes (otherwise themes don't do anything). |
If you don't have a gatsby-config in your theme's directory then you're really building a plugin because you're not using the theming gatsby-config composition and also not using Component Shadowing. This points at an interesting dynamic that we're sort of sidestepping right now in that plugins and themes are extremely similar. We're sidestepping that conversation because themes are under an experimental flag anyway, so they're "different" for now by nature of that "feature flag". I'll put the branch up and PR it so that you can follow the rewrite of this area @jbolda so that you aren't in the dark on what I'm doing :) |
So my initial expectation was when themes move out of experimental that they would be listed in the plugins array. As it is implemented now, I don't think that is really realistic. @ChristopherBiscardi makes the point that stuck in my mind as well. A theme really is a kind of plugin, just that it has the option to use For some context why I initially thought to add this error, I was making a theme and one of the "plugins" uses I think it is pretty clear that this specific PR should be closed, but it feels like we should head towards making themes a new second level plugin (e.g. gastby-theme). Assuming that, all of the other top level API files (node, browser, SSR) are all optional. However, also assuming that, we do need to deal with themes slightly different and then we need to be able to assume if it is actually a theme or not somehow... do we enforce the actual naming scheme and rely on that? I think I saw @DSchau head down that route in #10786. I still need to catch up on what others are doing here, but just talking out loud a bit. Anyways, closed. |
@jbolda to be clear--I don't want to enforce that naming standard, that's just the best way I have now (until a @ChristopherBiscardi PR is merged) to guess that a theme is a theme. |
It was totally clear @DSchau 👍 |
Description
Adding another error to throw before
nearMatch
if you forget to add agatsby-config.js
to your theme. It avoids a cryptic error thatnearMatch
would otherwise throw.Related Issues
None