diff --git a/.changeset/fast-dancers-grab.md b/.changeset/fast-dancers-grab.md new file mode 100644 index 000000000000..9f2e31e08943 --- /dev/null +++ b/.changeset/fast-dancers-grab.md @@ -0,0 +1,5 @@ +--- +'@sveltejs/adapter-vercel': major +--- + +breaking: remove obsolete `envVarsInUse` option diff --git a/documentation/docs/25-build-and-deploy/90-adapter-vercel.md b/documentation/docs/25-build-and-deploy/90-adapter-vercel.md index 9f81325e0e2c..7a04c63a89ce 100644 --- a/documentation/docs/25-build-and-deploy/90-adapter-vercel.md +++ b/documentation/docs/25-build-and-deploy/90-adapter-vercel.md @@ -54,8 +54,7 @@ The following options apply to all functions: - `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 - `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 -Additionally, the following options apply to edge functions: -- `envVarsInUse`: an array of environment variables that should be accessible inside the edge function +Additionally, the following option applies to edge functions: - `external`: an array of dependencies that esbuild should treat as external when bundling functions. This should only be used to exclude optional dependencies that will not run outside Node And the following option apply to serverless functions: @@ -130,7 +129,7 @@ export function load() {
This staging environment was deployed from {data.deploymentGitBranch}.
``` -Since all of these variables are unchanged between build time and run time when building on Vercel, we recommend using `$env/static/private` — which will statically replace the variables, enabling optimisations like dead code elimination — rather than `$env/dynamic/private`. If you're deploying with `edge: true` you must either use `$env/static/private` or populate the `envVarsInUse` configuration. +Since all of these variables are unchanged between build time and run time when building on Vercel, we recommend using `$env/static/private` — which will statically replace the variables, enabling optimisations like dead code elimination — rather than `$env/dynamic/private`. ## Notes diff --git a/packages/adapter-vercel/index.d.ts b/packages/adapter-vercel/index.d.ts index 5b4a70b3fd51..634f90ed8db9 100644 --- a/packages/adapter-vercel/index.d.ts +++ b/packages/adapter-vercel/index.d.ts @@ -63,11 +63,6 @@ export interface EdgeConfig { * More info: https://vercel.com/docs/concepts/edge-network/regions */ regions?: string[] | 'all'; - /** - * List of environment variable names that will be available for the Edge Function to utilize. - * Edge only. - */ - envVarsInUse?: string[]; /** * List of packages that should not be bundled into the Edge Function. * Edge only. diff --git a/packages/adapter-vercel/index.js b/packages/adapter-vercel/index.js index c947d80bab12..3dfbd9a73551 100644 --- a/packages/adapter-vercel/index.js +++ b/packages/adapter-vercel/index.js @@ -96,13 +96,6 @@ const plugin = function (defaults = {}) { const tmp = builder.getBuildDirectory(`vercel-tmp/${name}`); const relativePath = path.posix.relative(tmp, builder.getServerDirectory()); - const envVarsInUse = new Set(); - routes.forEach((route) => { - route.config?.envVarsInUse?.forEach((x) => { - envVarsInUse.add(x); - }); - }); - builder.copy(`${files}/edge.js`, `${tmp}/edge.js`, { replace: { SERVER: `${relativePath}/index.js`, @@ -133,7 +126,6 @@ const plugin = function (defaults = {}) { { runtime: config.runtime, regions: config.regions, - envVarsInUse: [...envVarsInUse], entrypoint: 'index.js' }, null,