Skip to content

Commit 48f4816

Browse files
authored
Vercel externals (#3614)
* expose external option on adapter-vercel * update docs * add an Options type
1 parent d0310c1 commit 48f4816

File tree

4 files changed

+20
-4
lines changed

4 files changed

+20
-4
lines changed

.changeset/eight-birds-run.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sveltejs/adapter-vercel': patch
3+
---
4+
5+
Expose external option

packages/adapter-vercel/README.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,17 @@ import vercel from '@sveltejs/adapter-vercel';
1414
export default {
1515
kit: {
1616
...
17-
adapter: vercel()
17+
adapter: vercel(options)
1818
}
1919
};
2020
```
2121

22+
## Options
23+
24+
You can pass an `options` argument, if necessary, with the following:
25+
26+
- `external` — an array of dependencies that [esbuild](https://esbuild.github.io/api/#external) should treat as external
27+
2228
## Changelog
2329

2430
[The Changelog for this package is available on GitHub](https://github.com./sveltejs/kit/blob/master/packages/adapter-vercel/CHANGELOG.md).

packages/adapter-vercel/index.d.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
import { Adapter } from '@sveltejs/kit';
22

3-
declare function plugin(): Adapter;
3+
type Options = {
4+
external?: string[];
5+
};
6+
7+
declare function plugin(options?: Options): Adapter;
48
export = plugin;

packages/adapter-vercel/index.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import esbuild from 'esbuild';
66
const dir = '.vercel_build_output';
77

88
/** @type {import('.')} **/
9-
export default function () {
9+
export default function ({ external = [] } = {}) {
1010
return {
1111
name: '@sveltejs/adapter-vercel',
1212

@@ -52,7 +52,8 @@ export default function () {
5252
outfile: `${dirs.lambda}/index.js`,
5353
target: 'node14',
5454
bundle: true,
55-
platform: 'node'
55+
platform: 'node',
56+
external
5657
});
5758

5859
writeFileSync(`${dirs.lambda}/package.json`, JSON.stringify({ type: 'commonjs' }));

0 commit comments

Comments
 (0)