Skip to content
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): don't break builds when using features unsupported by adapter (#38520) #38521

Merged
merged 1 commit into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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