Provide a method for disabling Adapters #38527
Unanswered
techfg
asked this question in
Ideas / Feature Requests
Replies: 1 comment
-
Tagging #38542 for cross-reference |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Background
Adapters are a great path forward for Gatsby, however the current functionality compared to previous methods (e.g., gatsby-plugin-gatsby-cloud, gatsby-plugin-netlify) is not yet at the same level. For example, these two plugins offer
allPageHeaders
andtransformHeaders
properties simplifying the ability to create a header for pages only and then transforming special cases for any header on any path. With the migration to Netlify from Gatsby Cloud, and for those already on Netlify (since Netlify is the only adapter currently), losing the functionality can have significant effects.Additionally, there are situations where you might "build" on a platform that has an adapter but be deploying to another platform entirely - or simply want full control of your build/deploy without side-effects. For example, on Netlify, the adapter will still execute even when
Build Settings->Runtime
is not Gatsby. Ironically, Netlify does provide a way to still executegatsby-plugin-netlify
via itsnetlify-plugin-gatsby
(NETLIFY_SKIP_GATSBY_BUILD_PLUGIN), however thegatsby-adapter-netlify
doesn't respect this environment variable and removes gatsby-plugin-netlify regardless.Currently, there is no way to disable Adapters - if the manifest finds a matching adapter on build, it will use it.
Given above (and likely others will have other reasons), there should be a method for disabling adapters.
Proposal
Allow gatsby config
adapter
property to be set tofalse
which would disable adapters (or provide an environment variable option).Workaround
Fortunately, Gatsby has an extensible adapter model so create a
noop
adapter essentially yields the same outcome as disabling (+/- a little overhead because noOpAdapterManager is not used).Warning
This code has not been fully tested for functionality, performance, etc., it is just a proof-of-concept - use at your own risk.
gatsby-config.ts
Thoughts/input welcome!
Beta Was this translation helpful? Give feedback.
All reactions