gatsby-plugin-utils
Version:
Gatsby utils that help creating plugins
13 lines (11 loc) • 328 B
text/typescript
export function isGatsbyNodeLifecycleSupported(apiName: string): boolean {
let availableAPIs
try {
availableAPIs = require(`gatsby/apis.json`)
} catch (e) {
throw new Error(
`Couldn't check available APIs. Make sure you are on gatsby version >=2.13.41`
)
}
return !!availableAPIs?.node?.[apiName]
}