diff --git a/.changeset/eight-birds-run.md b/.changeset/eight-birds-run.md new file mode 100644 index 000000000000..23349234e733 --- /dev/null +++ b/.changeset/eight-birds-run.md @@ -0,0 +1,5 @@ +--- +'@sveltejs/adapter-vercel': patch +--- + +Expose external option diff --git a/packages/adapter-vercel/README.md b/packages/adapter-vercel/README.md index 9fba0c62666f..637ee603559a 100644 --- a/packages/adapter-vercel/README.md +++ b/packages/adapter-vercel/README.md @@ -14,11 +14,17 @@ import vercel from '@sveltejs/adapter-vercel'; export default { kit: { ... - adapter: vercel() + adapter: vercel(options) } }; ``` +## Options + +You can pass an `options` argument, if necessary, with the following: + +- `external` — an array of dependencies that [esbuild](https://esbuild.github.io/api/#external) should treat as external + ## Changelog [The Changelog for this package is available on GitHub](https://github.com/sveltejs/kit/blob/master/packages/adapter-vercel/CHANGELOG.md). diff --git a/packages/adapter-vercel/index.d.ts b/packages/adapter-vercel/index.d.ts index 62aee0f1eaa9..25e220d37ec8 100644 --- a/packages/adapter-vercel/index.d.ts +++ b/packages/adapter-vercel/index.d.ts @@ -1,4 +1,8 @@ import { Adapter } from '@sveltejs/kit'; -declare function plugin(): Adapter; +type Options = { + external?: string[]; +}; + +declare function plugin(options?: Options): Adapter; export = plugin; diff --git a/packages/adapter-vercel/index.js b/packages/adapter-vercel/index.js index 5c5a38f2331d..269f88e59e3f 100644 --- a/packages/adapter-vercel/index.js +++ b/packages/adapter-vercel/index.js @@ -6,7 +6,7 @@ import esbuild from 'esbuild'; const dir = '.vercel_build_output'; /** @type {import('.')} **/ -export default function () { +export default function ({ external = [] } = {}) { return { name: '@sveltejs/adapter-vercel', @@ -52,7 +52,8 @@ export default function () { outfile: `${dirs.lambda}/index.js`, target: 'node14', bundle: true, - platform: 'node' + platform: 'node', + external }); writeFileSync(`${dirs.lambda}/package.json`, JSON.stringify({ type: 'commonjs' }));