Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vercel externals #3614

Merged
merged 3 commits into from
Jan 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/eight-birds-run.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/adapter-vercel': patch
---

Expose external option
8 changes: 7 additions & 1 deletion packages/adapter-vercel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
6 changes: 5 additions & 1 deletion packages/adapter-vercel/index.d.ts
Original file line number Diff line number Diff line change
@@ -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;
5 changes: 3 additions & 2 deletions packages/adapter-vercel/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',

Expand Down Expand Up @@ -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' }));
Expand Down