Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix: allow format to be a string in config file
  • Loading branch information
EGOIST committed Jun 5, 2022
1 parent 90f2d1a commit 0a96985
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/index.ts
Expand Up @@ -56,9 +56,12 @@ const normalizeOptions = async (
}
const options: Buildable<NormalizedOptions> = {
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
Expand Down
7 changes: 4 additions & 3 deletions src/options.ts
Expand Up @@ -72,7 +72,7 @@ export type Options = {
jsxFragment?: string
outDir?: string
outExtension?: OutExtensionFactory
format?: Format[]
format?: Format[] | string
globalName?: string
env?: {
[k: string]: string
Expand Down Expand Up @@ -176,10 +176,11 @@ export type Options = {
}

export type NormalizedOptions = Omit<
MarkRequired<Options, 'entry' | 'format' | 'outDir'>,
'dts'
MarkRequired<Options, 'entry' | 'outDir'>,
'dts' | 'format'
> & {
dts?: DtsConfig
tsconfigResolvePaths: Record<string, string[]>
tsconfigDecoratorMetadata?: boolean
format: Format[]
}

0 comments on commit 0a96985

Please sign in to comment.