From 3e2d31f2dfe82e098ea5440376d8a78e7766ff43 Mon Sep 17 00:00:00 2001 From: Alex Young Date: Sat, 20 Jan 2024 17:17:27 +0800 Subject: [PATCH] fix: Allow using `.swcrc` when no option defined (#165) --- index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/index.ts b/index.ts index 42a2a07..7dc9054 100644 --- a/index.ts +++ b/index.ts @@ -105,7 +105,10 @@ const nodeTargetDefaults = new Map([ function buildSwcTransformOpts(swcOptions: (Options & { experimental?: unknown }) | undefined): Options { // eslint-disable-next-line @typescript-eslint/no-unused-vars - const { experimental, ...computedSwcOptions } = swcOptions || (getOptionsFromSwrc() as Options & { experimental?: unknown }) + const { experimental, ...computedSwcOptions } = + swcOptions && Object.keys(swcOptions).length > 0 + ? swcOptions + : getOptionsFromSwrc() as Options & { experimental?: unknown } if (!computedSwcOptions.env && !computedSwcOptions.jsc?.target) { set(