0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00

fix(vercel): prevent build failure with node 21 (#9550)

* fix(vercel): prevent build failure with node 21

* add changeset
This commit is contained in:
Arsh 2023-12-29 15:48:15 +00:00 committed by GitHub
parent 48f47b50a0
commit 7b586a6e23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 7 deletions

View file

@ -0,0 +1,5 @@
---
"@astrojs/vercel": patch
---
Fixes an issue where a build could not complete on Node 21.

View file

@ -377,13 +377,6 @@ function validateRuntime() {
const version = process.version.slice(1); // 'v16.5.0' --> '16.5.0' const version = process.version.slice(1); // 'v16.5.0' --> '16.5.0'
const major = version.split('.')[0]; // '16.5.0' --> '16' const major = version.split('.')[0]; // '16.5.0' --> '16'
const support = SUPPORTED_NODE_VERSIONS[major]; const support = SUPPORTED_NODE_VERSIONS[major];
if (support.status === 'beta') {
console.warn(
`[${PACKAGE_NAME}] The local Node.js version (${major}) is currently in beta for Vercel Serverless Functions.`
);
console.warn(`[${PACKAGE_NAME}] Make sure to update your Vercel settings to use ${major}.`);
return;
}
if (support === undefined) { if (support === undefined) {
console.warn( console.warn(
`[${PACKAGE_NAME}] The local Node.js version (${major}) is not supported by Vercel Serverless Functions.` `[${PACKAGE_NAME}] The local Node.js version (${major}) is not supported by Vercel Serverless Functions.`
@ -392,6 +385,13 @@ function validateRuntime() {
console.warn(`[${PACKAGE_NAME}] Consider switching your local version to 18.`); console.warn(`[${PACKAGE_NAME}] Consider switching your local version to 18.`);
return; return;
} }
if (support.status === 'beta') {
console.warn(
`[${PACKAGE_NAME}] The local Node.js version (${major}) is currently in beta for Vercel Serverless Functions.`
);
console.warn(`[${PACKAGE_NAME}] Make sure to update your Vercel settings to use ${major}.`);
return;
}
if (support.status === 'deprecated') { if (support.status === 'deprecated') {
console.warn( console.warn(
`[${PACKAGE_NAME}] Your project is being built for Node.js ${major} as the runtime.` `[${PACKAGE_NAME}] Your project is being built for Node.js ${major} as the runtime.`