Skip to content

Commit 78a0986

Browse files
committed
update next.config.js target error message to be more clear
1 parent 59ee2bb commit 78a0986

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ module.exports = {
5757
const nextConfig = loadConfig(PHASE_PRODUCTION_BUILD, path.resolve('.'))
5858
const isValidTarget = acceptableTargets.includes(nextConfig.target)
5959
if (!isValidTarget) {
60-
return failBuild(`next.config.js must be one of: ${acceptableTargets.join(', ')}`)
60+
return failBuild(
61+
`Your next.config.js must set the "target" property to one of: ${acceptableTargets.join(', ')}`,
62+
)
6163
}
6264
} else {
6365
// Create the next config file with target set to serverless by default

test/index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,9 @@ describe('preBuild()', () => {
161161
utils,
162162
constants: { FUNCTIONS_SRC: 'out_functions' },
163163
}),
164-
).rejects.toThrow(`next.config.js must be one of: serverless, experimental-serverless-trace`)
164+
).rejects.toThrow(
165+
`Your next.config.js must set the "target" property to one of: serverless, experimental-serverless-trace`,
166+
)
165167
},
166168
)
167169
})

0 commit comments

Comments
 (0)