diff --git a/src/index.ts b/src/index.ts index 8ac5f349..d31ef334 100644 --- a/src/index.ts +++ b/src/index.ts @@ -56,9 +56,12 @@ const normalizeOptions = async ( } const options: Buildable = { target: 'node14', - format: ['cjs'], outDir: 'dist', ..._options, + format: + typeof _options.format === 'string' + ? [_options.format as Format] + : _options.format || ['cjs'], dts: typeof _options.dts === 'boolean' ? _options.dts diff --git a/src/options.ts b/src/options.ts index f37320c5..2f793483 100644 --- a/src/options.ts +++ b/src/options.ts @@ -72,7 +72,7 @@ export type Options = { jsxFragment?: string outDir?: string outExtension?: OutExtensionFactory - format?: Format[] + format?: Format[] | string globalName?: string env?: { [k: string]: string @@ -176,10 +176,11 @@ export type Options = { } export type NormalizedOptions = Omit< - MarkRequired, - 'dts' + MarkRequired, + 'dts' | 'format' > & { dts?: DtsConfig tsconfigResolvePaths: Record tsconfigDecoratorMetadata?: boolean + format: Format[] }