Skip to content

Commit 1d64898

Browse files
breaking: remove Node polyfills (and by extension support for Node 18) (#14732)
* breaking: remove Node polyfills (and by extension support for Node 18) * remove other references to node 18 * format --------- Co-authored-by: Tee Ming <[email protected]>
1 parent dfef62a commit 1d64898

File tree

5 files changed

+13
-8
lines changed

5 files changed

+13
-8
lines changed

.changeset/busy-mails-clean.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sveltejs/adapter-vercel': major
3+
---
4+
5+
breaking: remove Node polyfills (and by extension support for Node 18)

documentation/docs/25-build-and-deploy/90-adapter-vercel.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export const config = {
4242

4343
The following options apply to all functions:
4444

45-
- `runtime`: `'edge'`, `'nodejs18.x'`, `'nodejs20.x'` or `'nodejs22.x'`. By default, the adapter will select the `'nodejs<version>.x'` corresponding to the Node version your project is configured to use on the Vercel dashboard
45+
- `runtime`: `'edge'`, `'nodejs20.x'` or `'nodejs22.x'`. By default, the adapter will select the `'nodejs<version>.x'` corresponding to the Node version your project is configured to use on the Vercel dashboard
4646
> [!NOTE] This option is deprecated and will be removed in a future version, at which point all your functions will use whichever Node version is specified in the project configuration on Vercel
4747
- `regions`: an array of [edge network regions](https://vercel.com/docs/concepts/edge-network/regions) (defaulting to `["iad1"]` for serverless functions) or `'all'` if `runtime` is `edge` (its default). Note that multiple regions for serverless functions are only supported on Enterprise plans
4848
- `split`: if `true`, causes a route to be deployed as an individual function. If `split` is set to `true` at the adapter level, all routes will be deployed as individual functions

packages/adapter-vercel/files/serverless.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
import { installPolyfills } from '@sveltejs/kit/node/polyfills';
21
import { createReadableStream } from '@sveltejs/kit/node';
32
import { Server } from 'SERVER';
43
import { manifest } from 'MANIFEST';
54
import process from 'node:process';
65

7-
installPolyfills();
8-
96
const server = new Server(manifest);
107

118
await server.init({

packages/adapter-vercel/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ const get_default_runtime = () => {
3232
// Also means we're not on the hook for updating the adapter every time a new Node
3333
// version is added to Vercel.
3434
if (!process.env.VERCEL) {
35-
if (major < 18 || major > 22) {
35+
if (major < 20 || major > 22) {
3636
throw new Error(
37-
`Building locally with unsupported Node.js version: ${process.version}. Please use Node 18, 20 or 22 to build your project, or explicitly specify a runtime in your adapter configuration.`
37+
`Building locally with unsupported Node.js version: ${process.version}. Please use Node 20 or 22 to build your project, or explicitly specify a runtime in your adapter configuration.`
3838
);
3939
}
4040

@@ -305,9 +305,9 @@ const plugin = function (defaults = {}) {
305305
}
306306

307307
const node_runtime = /nodejs([0-9]+)\.x/.exec(runtime);
308-
if (runtime !== 'edge' && (!node_runtime || parseInt(node_runtime[1]) < 18)) {
308+
if (runtime !== 'edge' && (!node_runtime || parseInt(node_runtime[1]) < 20)) {
309309
throw new Error(
310-
`Invalid runtime '${runtime}' for route ${route.id}. Valid runtimes are 'edge' and 'nodejs18.x' or higher ` +
310+
`Invalid runtime '${runtime}' for route ${route.id}. Valid runtimes are 'edge' and 'nodejs20.x' or higher ` +
311311
'(see the Node.js Version section in your Vercel project settings for info on the currently supported versions).'
312312
);
313313
}

packages/adapter-vercel/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,8 @@
5252
},
5353
"peerDependencies": {
5454
"@sveltejs/kit": "^2.4.0"
55+
},
56+
"engines": {
57+
"node": ">=20.0"
5558
}
5659
}

0 commit comments

Comments
 (0)