chore: add config options to miniflare and esbuild external

This commit is contained in:
Jonathan Dunlap 2023-10-09 15:59:56 -04:00
parent 90d70eb7c4
commit 074b8af46c

View file

@ -49,6 +49,16 @@ type Options = {
*/
runtime?: 'off' | 'local' | 'remote';
wasmModuleImports?: boolean;
/**
* Additional externals to add to esbuild. Note that the external property adds to the existing list.
*/
esbuild?: {
external?: string[];
}
/**
* Additional config options to provide to the miniflare initialization object. Note that the options property adds to the existing list.
*/
miniflare?: object;
};
interface BuildConfig {
@ -141,6 +151,7 @@ export default function createIntegration(args?: Options): AstroIntegration {
kvPersist: true,
durableObjects: DOBindings,
durableObjectsPersist: true,
...(args?.miniflare || {}),
});
await _mf.ready;
@ -290,7 +301,9 @@ export default function createIntegration(args?: Options): AstroIntegration {
'node:stream',
'node:string_decoder',
'node:util',
'node:crypto',
'cloudflare:*',
...(args?.esbuild?.external || []),
],
entryPoints: pathsGroup,
outbase: absolutePagesDirname,
@ -372,7 +385,9 @@ export default function createIntegration(args?: Options): AstroIntegration {
'node:stream',
'node:string_decoder',
'node:util',
'node:crypto',
'cloudflare:*',
...(args?.esbuild?.external || [])
],
entryPoints: [entryPath],
outfile: buildPath,