Skip to content

Commit c076f04

Browse files
zjpalaszgeoffrich
andauthored
feat: add esbuildOptions to config (#51)
* Adds esbuild options * Exposing only external & keepNames. Adding esbuild options to readme. * Only including external. * Tweak docs Co-authored-by: Geoff Rich <[email protected]>
1 parent bfdd58c commit c076f04

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,3 +117,23 @@ export default {
117117
}
118118
};
119119
```
120+
121+
### esbuildOptions
122+
123+
An object containing additional [esbuild options](https://esbuild.github.io/api/#build-api). Currently only supports [external](https://esbuild.github.io/api/#external). If you require additional options to be exposed, plese [open an issue](https://github.com/geoffrich/svelte-adapter-azure-swa/issues).
124+
125+
126+
```js
127+
import azure from 'svelte-adapter-azure-swa';
128+
129+
export default {
130+
kit: {
131+
...
132+
adapter: azure({
133+
esbuildOptions: {
134+
external: ['fsevents']
135+
}
136+
})
137+
}
138+
};
139+
```

index.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import { Adapter } from '@sveltejs/kit';
22
import { CustomStaticWebAppConfig } from './types/swa';
3+
import esbuild from 'esbuild';
34

45
type Options = {
56
debug?: boolean;
67
customStaticWebAppConfig?: CustomStaticWebAppConfig;
8+
esbuildOptions?: Pick<esbuild.BuildOptions, 'external'>;
79
};
810

911
export default function plugin(options?: Options): Adapter;

index.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ function validateCustomConfig(config) {
2525
}
2626

2727
/** @type {import('.').default} */
28-
export default function ({ debug = false, customStaticWebAppConfig = {} } = {}) {
28+
export default function ({
29+
debug = false,
30+
customStaticWebAppConfig = {},
31+
esbuildOptions = {}
32+
} = {}) {
2933
return {
3034
name: 'adapter-azure-swa',
3135

@@ -108,7 +112,8 @@ export default function ({ debug = false, customStaticWebAppConfig = {} } = {})
108112
outfile: join(apiDir, 'index.js'),
109113
bundle: true,
110114
platform: 'node',
111-
target: 'node16'
115+
target: 'node16',
116+
external: esbuildOptions.external
112117
};
113118

114119
await esbuild.build(default_options);

0 commit comments

Comments
 (0)