Skip to content

Commit

Permalink
fix(gatsby): don't break builds when using features unsupported by ad…
Browse files Browse the repository at this point in the history
…apter (#38520)

(cherry picked from commit 6674ad6)
  • Loading branch information
pieh committed Sep 5, 2023
1 parent 4b082d3 commit 1a2afe9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
3 changes: 3 additions & 0 deletions packages/gatsby-cli/src/structured-errors/error-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -926,6 +926,9 @@ const errors: Record<string, IErrorMapEntry> = {
type: Type.ADAPTER,
category: ErrorCategory.SYSTEM,
},
// Currently not used, as the error was turned into warning
// Might be used in next major version of gatsby, but we still have to keep it
// because older gatsby versions might try to use this error ID
"12201": {
text: (context): string =>
`Adapter "${
Expand Down
18 changes: 8 additions & 10 deletions packages/gatsby/src/utils/adapter/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,7 @@ async function setAdapter({
store.getState().program.prefixPaths &&
store.getState().config.pathPrefix
) {
incompatibleFeatures.push(
`pathPrefix is not supported. Please remove the pathPrefix option from your gatsby-config, don't use "--prefix-paths" CLI toggle or PREFIX_PATHS environment variable.`
)
incompatibleFeatures.push(`pathPrefix is not supported.`)
}

// trailingSlash support
Expand All @@ -98,13 +96,13 @@ async function setAdapter({
}

if (incompatibleFeatures.length > 0) {
reporter.panic({
id: `12201`,
context: {
adapterName: instance.name,
incompatibleFeatures,
},
})
reporter.warn(
`Adapter "${
instance.name
}" is not compatible with following settings:\n${incompatibleFeatures
.map(line => ` - ${line}`)
.join(`\n`)}`
)
}

if (configFromAdapter.pluginsToDisable.length > 0) {
Expand Down

0 comments on commit 1a2afe9

Please sign in to comment.