From 4d32c1700bb2bdb5c56afd26539598b0968dda84 Mon Sep 17 00:00:00 2001 From: SukkaW Date: Sun, 10 Dec 2023 19:48:01 +0800 Subject: [PATCH 1/2] feat(core): add `ignoreDynamic` option --- packages/core/index.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/core/index.ts b/packages/core/index.ts index cb7c7f04a..1ef742904 100644 --- a/packages/core/index.ts +++ b/packages/core/index.ts @@ -28,6 +28,7 @@ export interface Options { [from: string]: [string] } swc?: SwcOptions + ignoreDynamic?: boolean } function transformOption(path: string, options?: Options, jest = false): SwcOptions { @@ -70,6 +71,7 @@ function transformOption(path: string, options?: Options, jest = false): SwcOpti ...(moduleType === 'commonjs' || moduleType === 'umd' || moduleType === 'amd' ? { noInterop: !opts.esModuleInterop, + ignoreDynamic: opts.ignoreDynamic, } : undefined), }, From 08629752249dc27e9f5b72a9af606dfd6fd7b48a Mon Sep 17 00:00:00 2001 From: SukkaW Date: Sun, 10 Dec 2023 19:55:23 +0800 Subject: [PATCH 2/2] feat(register): add `SWC_NODE_IGNORE_DYNAMIC` env option --- packages/register/read-default-tsconfig.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/register/read-default-tsconfig.ts b/packages/register/read-default-tsconfig.ts index 6e6b56da9..0b438ca75 100644 --- a/packages/register/read-default-tsconfig.ts +++ b/packages/register/read-default-tsconfig.ts @@ -137,6 +137,7 @@ export function tsCompilerOptionsToSwcConfig(options: ts.CompilerOptions, filena ((aliasPaths as string[]) ?? []).map((path) => resolve(options.baseUrl ?? './', path)), ]), ) as Options['paths'], + ignoreDynamic: Boolean(process.env.SWC_NODE_IGNORE_DYNAMIC), swc: { sourceRoot: options.sourceRoot, inputSourceMap: options.inlineSourceMap,